>>> import vk
>>> api = vk.Api('YOUR_TOKEN')
>>> user = api.get_user('durov')
>>> user.first_name
$ pip install py-vkontakte
>>> import vk
>>> api = vk.Api(TOKEN)
>>> group = api.get_group('team') # vk.com/team
>>> group.send_messages(user_id, message='Hello')
$ pip install py-vkontakte
>>> import vk
>>> api = vk.Api(TOKEN)
>>> group = api.get_group('team') # vk.com/team
>>> user_items = [user for user in group.get_members()]
>>> user_id_items = [user_id for user_id in group.get_members_only_id()]
import vk
api = vk.Api(YOUR_TOKEN)
group = api.get_group(YOUR_GROUP_ID_OR_SLUG)
all_comments = [comments for wall in group.get_walls() for comment in wall.get_comments()]
$ pip install py-vkontakte
def get_user_not_found(users):
for user in users:
try:
api.get_user(user)
except vk.error.VKError as err:
if '113' == err.code:
yield user
>>> ['asdf0aisdf', 'durov', 123]
>>> [user for user in get_user_not_found(users)]
['asdf0aisdf']