vk.com is the largest social network in Russia. This library is significantly improved fork of vk
pip install vk-requests
import vk_requests
api = vk_requests.create_api(app_id=123, login='User', password='Password')
api.users.get(user_ids=1)
[{'first_name': 'Pavel', 'last_name': 'Durov', 'id': 1}]
Just pass scope
and/or api_version
parameters like
api = vk_requests.create_api(..., scope=['offline', 'status'], api_version='5.00')
api.status.set(text='Hello world!')
From your code:
import logging
logging.getLogger('vk-requests').setLevel(logging.DEBUG)
# Returns list of users
api.users.get(users_ids=1)
# Returns list of user's friends with extra fields
api.friends.get(user_id=1, fields=['nickname', 'city'])
# Returns result list from your custom api method
api.execute.YourMethod(**method_params)
Useful for dev purposes. You will be asked about login, password and app_id interactively in console. Useful if CAPTCHA required.
from vk_requests.api import API
from vk_requests.auth import InteractiveVKSession
api = vk_requests.create_api(..., session_cls=InteractiveVKSession)
Just pass your phone number during API initialization. In case of security check it will be handled automatically, otherwise console input will be asked
api = vk_requests.create_api(
app_id=123, login='User', password='Password', phone_number='+79111234567')
tox
Warm welcome for suggestions and concerns