I
I
Ilya Bugaets2020-06-06 10:08:59
Python
Ilya Bugaets, 2020-06-06 10:08:59

Why is the bot crashing?

Every night the VK bot crashes with the error requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='lp.vk.com', port=443): Read timed out. (read timeout=35). Tried try except but didn't help. How to fix it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2020-06-06
@ilyabugaets

there is no connection to the Internet, you need to figure out how to wait for it to appear and start the bot again.
Use a loop:

while True:
    try:
        vk.poling()
    except:
        time.sleep(60)

so that in case of an error it tries to resume the bot once every 1 minute - when the poll crashes, the script waits and repeats the cycle.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question