Skip to main content

Python API wrapper around vk.com API

Project description

py-vkontakte — Python client for API vk.com

Build codecov
Package GitHub release Solid Solid

Table of contents

Install

pip install py-vkontakte

Run tests

pip install -r requirements-dev.txt
pytest

First start

>>> import vk
>>> api = vk.Api('YOUR_TOKEN')

User

>>> user = api.get_user('durov')  # single user
>>> user_items = api.get_users([1, 's.gaynetdinov'])  # many user
>>> [user.id for user in user_items]
[1, 23768217]
# User object
>>> user.id  # 1
>>> user.first_name  # 'Павел'
>>> user.last_name  # 'Дуров'
>>> user.maiden_name  # None
>>> user.nickname  # ''
>>> user.bdate  # '10.10.1984'
>>> user.sex  # 'male'
>>> user.status  # '道德經'
>>> user.site  # 'http://t.me/durov'
>>> user.relation  # None
>>> user.relation_partner  # None
>>> user.facebook  # '501012028'
>>> user.skype  # None
>>> user.twitter  # 'durov'
>>> user.livejournal  # None
>>> user.instagram  # 'durov'
>>> user.is_verified  # True
>>> user.is_trending  # False
>>> user.domain  # 'durov'
>>> user.screen_name  # 'durov'
>>> user.last_seen  # datetime.datetime
>>> user.platform  # 'web (vk.com)'
>>> user.is_deactivated  # False
>>> user.is_deleted  # False
>>> user.is_banned  # False

>>> user.get_about()
>>> user.get_activities()
>>> user.get_books()
>>> user.get_career()  # UserCareer
>>> user.get_games()
>>> user.get_movies()
>>> user.get_music()
>>> user.get_quotes()
>>> user.get_tv()

UserCareer

>>> career = user.get_career()
>>> career.group
>>> career.company
>>> career.country
>>> career.city
>>> career.city_name
>>> career.start
>>> career.end
>>> career.position

Group

>>> groups_items = api.get_groups([1, 'devclub'])  # return generator
>>> [group for group in groups_items]
[<Group: apiclub>, <Group: devclub>]
# checking a user is a member of a current group
>>> user = api.get_user('durov')
>>> group = api.get_group('telegram')
>>> user in group  # or 100500 in group

Download files

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

Files for py-vkontakte, version 5.70.1
Filename, size File type Python version Upload date Hashes
Filename, size py_vkontakte-5.70.1-py3-none-any.whl (17.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size py-vkontakte-5.70.1.tar.gz (12.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