forked from python273/vk_api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
28 lines (21 loc) · 957 Bytes
/
Copy pathexample.py
File metadata and controls
28 lines (21 loc) · 957 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
import vk_api
__author__ = "Kirill Python"
__contact__ = "https://vk.com/python273"
""" Пример получения последнего сообщения со стены """
def main():
password = u'mypassword'
try:
vk = vk_api.VkApi(login, password) # Авторизируемся
except vk_api.authorization_error, error_msg:
print error_msg # В случае ошибки выведем сообщение
return # и выйдем
values = {
'count': 1 # Получаем только одно сообщение
}
response = vk.method('wall.get', values) # С использованием метода wall.get
print response[1]['text'] # Печатаем текст последнего поста со стены
if __name__ == '__main__':
main()