Skip to content

konstantintogoi/aiookru

Repository files navigation

https://readthedocs.org/projects/aiookru/badge/?version=latest

aiookru

async python ok.ru API wrapper for REST API methods.

Usage

To use ok.ru API you need a registered app and an access_token.

import aiookru

client_id = '12345678'
application_key = 'ABCDEFGHIJKLMNOPQ'
application_secret_key = '0A1B2C3D4E5F6G7H8I9K10L11M12N13O14P15Q'
redirect_uri = 'http://apiok.ru/oauth_callback'

code = ''  # get code from login form

async with aiookru.CodeGrant(client_id, application_secret_key, redirect_uri, code) as grant:
    access_token = grant.access_token
    refresh_token = grant.refresh_token

async with aiookru.API(access_token, application_key, application_secret_key=application_secret_key) as okru:
    events = await okru.events.get()

async with aiookru.RefreshGrant(client_id, application_secret_key, refresh_token) as grant:
    access_token = grant.access_token

For more details, see authorization instruction.

Installation

$ pip install aiookru

Supported Python Versions

Python 3.7, 3.8, 3.9 are supported.

License

aiookru is released under the BSD 2-Clause License.