M
M
mrsakura522022-01-26 16:47:46
Python
mrsakura52, 2022-01-26 16:47:46

How to fix pyTelegramBotApi error?

Very often an error occurs when the bot works in the telegram:

raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))

I'm using Python 3.7, I suspect a bad telegram connection and a timeout.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Dedinets, 2022-01-28
@mrsakura52

First import sleep Next make bot.polling into a loopfrom time import sleep

while True:
    try:
        bot.polling(none_stop=True)
    except Exception as _ex:
        print(_ex)
        sleep(15)

Now it will just throw this error

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question