Skip to main content
https://badge.fury.io/py/python-vkontakte.svg

Python library to access vkontakte social network api.

Installation

Via pip:

pip install python-vkontakte

Api

import pyvkontakte
api = pyvkontakte.VkontakteApi()
api.call('users.get', user_ids=1) # [{'last_name': 'Дуров', 'id': 1, 'first_name': 'Павел'}]

or calling method via class attribute:

api.users_get(user_ids=1) # [{'last_name': 'Дуров', 'id': 1, 'first_name': 'Павел'}]

Are both the same. In a second form, it is a method name where dots replaced with underscores - wall.getById will be wall_getById and so on.

If you want to call some private api, which require access token, just create a api class with it:

pyvkontakte.VkontakteApi('access token')

Using different api version:

pyvkontakte.VkontakteApi(v='5.50')

If some error occures after api request (response json contains error insead of response key), pyvkontakte.VkontakteApiError will be raised. Special attribute json will be avaible on exception object, additionally exception str representation will contain error description and error code.

Authorization

For obtaining access token, you can use pyvkontakte.auth method.

pyvkontakte.auth(login, password, client_id, scope)

which will return dict with keys access_token, expires_in, user_id. If login or password is invalid, pyvkontakte.InvalidCredentials will be raised. If some parsing error occurs, pyvkontakte.ParsingError will be raised. Both pyvkontakte.InvalidCredentials and pyvkontakte.ParsingError are subclasses of pyvkontakte.VkontakteAuthError.

There is also a logger pyvkontakte (pyvkontakte.auth and pyvkontakte.api) enabled. pyvkontakte.api logs an INFO every request made with request params, and DEBUG with json of response

History

1.1.2 (2016-05-13)

  • Fixed setup.py requires option (changed to install_requires)

1.1.1 (2016-04-27)

  • Some refactoring for easier VkontakteApi extending

1.1.0 (2016-04-21)

  • Fixed auth issue

1.0.0 (2016-04-16)

  • First PyPi release

0.1.0 (2016-04-16)

  • Initial release

Metadata

Release files for python-vkontakte 1.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-vkontakte 1.1.2
File Size Uploaded
python-vkontakte-1.1.2.zip 6.5 kB Details

Release files / python-vkontakte-1.1.2.zip

Download URL python-vkontakte-1.1.2.zip
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8ecd0b49a22110f0d60d01ffff3259e33f146cd54786bf182484e0018bc6850d
BLAKE2b-256 checksum
How to use checksums
a72ce9ca0f1483a773c7dcbc114aefbbabd5b86c268da17948495301cd075cf2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.1.2 This release

1 release file

1.1.1

1 release file

1.1

1 release file

1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page