LoadLocation looks in the directory or uncompressed zip file named by the ZONEINFO environment variable, if any, then looks in known installation locations on Unix systems, and finally looks in $GOROOT/lib/time/zoneinfo.zip.
>>> import vk
>>> api = vk.Api('YOUR_TOKEN')
>>> user = api.get_user('durov')
>>> user.first_name
import vk
api = vk.Api(VK_GROUP_TOKEN)
group = api.get_group(VK_GROUP_ID)
group.send_messages(USER_ID, image_files=[file1, file2])
$ 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']
В интерфейсе настроек сообщества. Для этого достаточно открыть раздел «Управление сообществом» («Управление страницей», если у Вас публичная страница), выбрать вкладку «Работа с API» и нажать «Создать ключ доступа». — https://vk.com/dev/access_token
>>> import vk
>>> api = vk.Api(ACCESS_TOKEN)
>>> group = api.get_group('telegram')
>>> wall_items = group.get_walls()