This is an ultimate library for vk.com API written in Python.
Just:
git clone https://github.com/ISosnovik/vkAPI
cd vkAPI
python setup.py install
To begin with:
from vkapi.methods import *
You can use it exactly as it is described here. For example:
users.get(user_ids=1, fields='city')
#[{'city': 2, 'first_name': 'Pavel', 'last_name': 'Durov', 'uid': 1}]
Some methods use access_token
. It shouldn't be passed as a parameter to method. Nevertheless, it is defined as a class property token
in vkapi.vkapi.Config
class. Just set it at the beginnig:
from vkapi.methods import *
from vkapi import Config
Config.token = 'h3r3-1s-th3-4cc3ss-t0k3n'
account.getInfo(fields='country')
And that is it.
All methods are provided with short description and reference to the official documentation. If you forget something, just call help
or shift + tab + tab
for Jupyter Notebook and you will get the description:
Help on function resolveScreenName in module vkapi.methods.utils:
resolveScreenName(screen_name=None)
Detects a type of object (e.g., user, community, application)
and its ID by screen name.
https://vk.com/dev/utils.resolveScreenName
There are several examples of use of vkapi.