Skip to content

Commit

Permalink
upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
konstantintogoi committed Aug 3, 2024
1 parent 5892124 commit 30d4715
Show file tree
Hide file tree
Showing 27 changed files with 1,192 additions and 1,903 deletions.
15 changes: 15 additions & 0 deletions Pipfile
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"
256 changes: 256 additions & 0 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

95 changes: 95 additions & 0 deletions README.md
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.
Loading

0 comments on commit 30d4715

Please sign in to comment.