Simple asynchronous VK API client library by megahomyak.
For Python 3.5+ (because it uses typing)!
It's so simple it fits in one file.
It supports:
- VK API methods calling (with
call_methodmethod) - Receiving events (with longpoll;
get_new_eventsandlistenmethods) - Errors raising if something went wrong
-
Install the library and import it (you need only
SimpleAVKclass)Install it:
pip install simple_avkImport it:
from simple_avk import SimpleAVK -
Create an object of class
SimpleAVK(simple_avk.SimpleAVK), passing token, aiohttp session, maybe group id or other params to itvk = SimpleAVK(aiohttp_session=session, token="your token", group_id=1234567890) -
Here we go! Now you can call VK methods with
call_methodmethod, listen to the longpoll withlistenmethod or get list of events withget_new_eventsmethod:Listening example:
async for event in vk.listen(): ...Getting list of events example:
events = await vk.get_new_events()Calling API method example:
users_info = await vk.call_method("users.get", {"user_ids": "1,2,3"})