-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5892124
commit 30d4715
Showing
27 changed files
with
1,192 additions
and
1,903 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[[source]] | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
name = "pypi" | ||
|
||
[packages] | ||
httpx = "==0.24.1" | ||
|
||
[dev-packages] | ||
pytest = "==7.4.0" | ||
pytest-asyncio = "==0.21.0" | ||
pytest-localserver = "==0.7.1" | ||
|
||
[requires] | ||
python_version = "3.7" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
[![LICENSE](https://img.shields.io/badge/license-BSD-blue.svg)](https://github.com/KonstantinTogoi/aiookru/blob/master/LICENSE) | ||
[![Last Release](https://img.shields.io/pypi/v/aiookru.svg)](https://pypi.python.org/pypi/aiookru) | ||
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/aiookru.svg)](https://pypi.python.org/pypi/aiookru) | ||
|
||
# aiookru | ||
|
||
aiookru is a python [ok.ru API](https://apiok.ru/) wrapper. | ||
The main features are: | ||
|
||
* authorization ([Authorization Code](https://oauth.net/2/grant-types/authorization-code/), [Password Grant](https://oauth.net/2/grant-types/password/), [Refresh Token](https://oauth.net/2/grant-types/refresh-token/)) | ||
* [REST API](https://apiok.ru/en/dev/methods/rest) methods | ||
|
||
|
||
## Usage | ||
|
||
To use [ok.ru API](https://apiok.ru/) you need a registered app and [ok.ru](https://ok.ru) account. | ||
For more details, see [aiookru Documentation](https://konstantintogoi.github.io/aiookru). | ||
|
||
### Client application | ||
|
||
Use `ClientSession` when REST API is needed in: | ||
|
||
- client component of the client-server application | ||
- standalone mobile/desktop application | ||
|
||
i.e. when you embed your app's info (application key) in publicly available code. | ||
|
||
```python | ||
from aiookru import ClientSession, API | ||
|
||
session = ClientSession(app_id, app_key, access_token, session_secret_key) | ||
api = API(session) | ||
|
||
events = await api.events.get() | ||
friends = await api.friends.get() | ||
``` | ||
|
||
Pass `session_secret_key` and `access_token` | ||
that were received after authorization. | ||
For more details, see [authorization instruction](https://konstantintogoi.github.io/aiookru/authorization). | ||
|
||
### Server application | ||
|
||
Use `ServerSession` when REST API is needed in: | ||
|
||
- server component of the client-server application | ||
- requests from your servers | ||
|
||
```python | ||
from aiookru import ServerSession, API | ||
|
||
session = ServerSession(app_id, app_key, app_secret_key, access_token) | ||
api = API(session) | ||
|
||
events = await api.events.get() | ||
friends = await api.friends.get() | ||
``` | ||
|
||
Pass `app_secret_key` and `access_token` that was received after authorization. | ||
For more details, see [authorization instruction](https://konstantintogoi.github.io/aiookru/authorization). | ||
|
||
## Installation | ||
|
||
```shell | ||
pip install aiookru | ||
``` | ||
|
||
or | ||
|
||
```shell | ||
python setup.py install | ||
``` | ||
|
||
## Supported Python Versions | ||
|
||
Python 3.5, 3.6, 3.7 and 3.8 are supported. | ||
|
||
## Test | ||
|
||
Run all tests. | ||
|
||
```shell | ||
python setup.py test | ||
``` | ||
|
||
Run tests with PyTest. | ||
|
||
```shell | ||
python -m pytest [-k TEST_NAME] | ||
``` | ||
|
||
License | ||
------- | ||
|
||
**aiookru** is released under the BSD 2-Clause License. |
Oops, something went wrong.