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(

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

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

    # ...
    # ...

    '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, but OdnoklassnikiError might be enough. See full list of API methods and error codes at Odnoklassniki API documentation.

    response =
except pyodnoklassniki.OdnoklassnikiError as exc:
    print exc
    for group in response['groups']:
                                   fields='name, description')

You can process particular error code such as PARAM_SESSION_EXPIRED as well.

from pyodnoklassniki import errors

    response = ok_api.users.getCurrentUser()
except pyodnoklassniki.AuthError as exc:
    if exc.code == errors.PARAM_SESSION_EXPIRED:
        # Renew session...

Project details

Download files

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

Files for pyodnoklassniki, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size pyodnoklassniki-1.0.0.tar.gz (5.3 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page