nickoala / telepot

Python framework for Telegram Bot API
MIT License
2.42k stars 474 forks source link

doubt MaxRetryError: HTTPSConnectionPool #331

Open jcvo90 opened 7 years ago

jcvo90 commented 7 years ago

Hi, I'm making a prototype, however when it is without interenet the following error appears:

MaxRetryError: HTTPSConnectionPool(host='api.telegram.org', port=443): Max retries exceeded with url: /bot380569822:AAlkjyc7y2Q_SYw-To2WkyxR3IHhyenjDkw/getUpdates (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb4a48fd0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution',)) Traceback (most recent call last): File "/usr/local/lib/python2.7/dist-packages/telepot/loop.py", line 60, in run_forever allowed_updates=allowed_updates) File "/usr/local/lib/python2.7/dist-packages/telepot/init.py", line 909, in getUpdates return self._api_request('getUpdates', _rectify(p)) File "/usr/local/lib/python2.7/dist-packages/telepot/init.py", line 434, in _api_request return api.request((self._token, method, params, files), *kwargs) File "/usr/local/lib/python2.7/dist-packages/telepot/api.py", line 154, in request r = fn(args, kwargs) # fn must be thread-safe File "/usr/lib/python2.7/dist-packages/urllib3/request.py", line 148, in request_encode_body return self.urlopen(method, url, extra_kw) File "/usr/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 244, in urlopen response = conn.urlopen(method, u.request_uri, kw) File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 671, in urlopen release_conn=release_conn, response_kw) File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 671, in urlopen release_conn=release_conn, response_kw) File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 671, in urlopen release_conn=release_conn, response_kw) File "/usr/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 643, in urlopen _stacktrace=sys.exc_info()[2]) File "/usr/lib/python2.7/dist-packages/urllib3/util/retry.py", line 363, in increment raise MaxRetryError(_pool, url, error or ResponseError(cause))

the program seems to fall into an infinite loop independent of the return to the internet connection, is there any way to unlock it? thanks

das7pad commented 7 years ago

@jcvo90 first of all please revoke the api-token for your bot: run /revoke in the chat with @BotFather. Just editing the Issue does not help.

I do agree that the error handling in the MessageLoops could be improved.

jcvo90 commented 7 years ago

hi @das7pad Sorry, I did not understand the purpose of revoking the token, my problem is that I do not want my program to be in that infinite loop because it stops my other routines

das7pad commented 7 years ago

@jcvo90 The API-token 380569822:AAlkjyc7y2Q_SYw-To2WkyxR3IHhyenjDkw should remain private. Everybody could pull updates from the chats your bot is participating in and push messages/etc. Please reset the token to a new one - this process is called revoking.

jcvo90 commented 7 years ago

Thank you very much for your suggestion

jcvo90 commented 7 years ago

hello, is there any way to stop the infinite loop? since the program blocks when there is no internet

AntoDGpy commented 5 years ago

Hello everybody, The infinite loop issue has been solved? Thaks a lot.