PyOdnoklassniki is Odnoklassniki REST API wrapper
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')
You can process particular error code such as PARAM_SESSION_EXPIRED as well.
from pyodnoklassniki import errors
try:
response = ok_api.users.getCurrentUser()
except pyodnoklassniki.AuthError as exc:
if exc.code == errors.PARAM_SESSION_EXPIRED:
# Renew session...
pass
Metadata
Release files for pyodnoklassniki 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyodnoklassniki-1.0.0.tar.gz | 5.3 kB | Without provenance | Details for pyodnoklassniki-1.0.0.tar.gz |
Release files / pyodnoklassniki-1.0.0.tar.gz
| Download URL | pyodnoklassniki-1.0.0.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b44272d2fced159a8a128da6a5ab33a8ac03a50a5b00b77f36d31e5e4395edf9
|
|
BLAKE2b-256 checksum How to use checksums |
03e25f954c7c0d06a579ae5d3003a60622b932bb284e560965d2df80e89f3da9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for pyodnoklassniki 1.0.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.