Skip to main content

Odnoklassniki REST API wrapper.

Project description

This library consists of an API interface for Odnoklassniki and Django middleware which helps to configure it.

Usage example:

import pyodnoklassniki

pyodnoklassniki.app_pub_key = 'CBAJ...BABA'
pyodnoklassniki.app_secret_key = '123...XYZ'

ok_api = pyodnoklassniki.OdnoklassnikiAPI(
    access_token='kjdhfldjfhgldsjhfglkdjfg9ds8fg0sdf8gsd8fg')

try:
    print ok_api.users.getCurrentUser()
except pyodnoklassniki.OdnoklassnikiError as exc:
    print exc

You might find that configuring library with Django Middleware is more convenient.

MIDDLEWARE_CLASSES = (
    # ...
    'pyodnoklassniki.contrib.django.middleware.PyOdnoklassnikiMiddleware',
    # ...
)

PYODNOKLASSNIKI = {
    'app_pub_key': 'CBAJ...BABA',
    'app_secret_key': '123...XYZ',
}

Use dotted notation to invoke API method. Query parameters are passed as keyword arguments. Odnoklassniki error codes are grouped by meaning in exceptions.py, but OdnoklassnikiError might be enough. See full list of API methods and error codes at Odnoklassniki API documentation.

try:
    response = ok_api.group.getUserGroupsV2()
except pyodnoklassniki.OdnoklassnikiError as exc:
    print exc
else:
    for group in response['groups']:
        print ok_api.group.getInfo(uids=group['groupId'],
                                   fields='name, description')

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyodnoklassniki-0.11.tar.gz (4.4 kB view details)

Uploaded Source

File details

Details for the file pyodnoklassniki-0.11.tar.gz.

File metadata

File hashes

Hashes for pyodnoklassniki-0.11.tar.gz
Algorithm Hash digest
SHA256 ec49f38ca94c91019ea698d233d86be2f5147e3b039b8ea033846a965367f195
MD5 ace96849b53061537266d33578212437
BLAKE2b-256 884e629f52be6ff943e9836bb58b72adbb146176f9265ff076a124601b1a5319

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page