Answer the question
In order to leave comments, you need to log in
The vkapi.messages.getHistory method doesn't work, what's wrong?
Hello!
I set myself the following task: download the history of correspondence from a VK group conversation.
I am using Python 3.4.4 + vk library
import vk
from MyVkData import MyVkData
# использую созданный мною класс MyVkData чтобы скрыть свои пароли логины
session = vk.AuthSession(app_id=MyVkData.APP_ID, user_login=MyVkData.LOGIN,
user_password=MyVkData.GET_PASSWORD(),
access_token=MyVkData.TOKEN, scope='messages, offline' )
vkapi = vk.API(session)
# беседа в вк называется '1+сердечко'
chat = vkapi.messages.searchDialogs(q='1')
chat = chat[0]
# получаю chat_id = 1
chat_id = chat['chat_id']
history = vkapi.messages.getHistory(count=200, peer_id=2000000000 + chat_id)
print(history)
Answer the question
In order to leave comments, you need to log in
You forget to pass the API version in your requests, because VK considers that you are working with the third version of the API (the current one is 5.65). Accordingly, the parameters for requests in different versions of the API may vary.
The documentation for the library you are using has an example of specifying the API version :
session = vk.Session()
api = vk.API(session, v='5.35', lang='ru', timeout=10)
api.method.name(param=value)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question