Answer the question
In order to leave comments, you need to log in
VK api: timeout doesn't fit into C timeval what does it mean, how to fix it?
I run a simple script on vk_api python:
import vk_api
from vk_api.longpoll import VkLongPoll, VkEventType
vk_session = vk_api.VkApi(token='TOKEN')
lp = VkLongPoll(vk_session, 123456789) #эти цифры являются айди группы, в которой запускается бот
vk = vk_session.get_api()
try:
for event in lp.listen():
if event.type == VkEventType.MESSAGE_NEW and event.to_me and event.from_user:
vk.messages.send(
user_id=event.user_id,
message='messezhe'
)
except Exception as e:
print(e)
timeout doesn't fit into C timeval
Answer the question
In order to leave comments, you need to log in
The second parameter for VkLongPoll is wait (the same timeout)
class vk_api.longpoll.VkLongPoll(vk, wait=25, mode=234, preload_messages=False, group_id=None)
wait - the waiting period (as most proxy servers terminate the connection after 30 seconds, we recommend indicating wait = 25). Maximum: 90
lp = VkLongPoll(vk_session, group_id=123456789)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question