'Network errors with Python Telegram Bot
I use a Python Telegram Bot script in Visual Studio Code on my PC, and sometimes i have this error:
telegram.ext.dispatcher - ERROR - No error handlers are registered, logging exception. Traceback (most recent call last):
connectionpool.py", line 614, in urlopen httplib_response = self._make_request(conn, method, url,
connectionpool.py", line 402, in _make_request six.raise_from(e, None)
connectionpool.py", line 398, in _make_request httplib_response = conn.getresponse()
client.py", line 1322, in getresponse response.begin()
client.py", line 303, in begin version, status, reason = self._read_status()
client.py", line 264, in _read_status line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
socket.py", line 669, in readinto return self._sock.recv_into(b)
ssl.py", line 1241, in recv_into return self.read(nbytes, buffer)
ssl.py", line 1099, in read return self._sslobj.read(len, buffer)
ConnectionResetError: [WinError 10054]
telegram.error.NetworkError: urllib3 HTTPError ('Connection aborted.', ConnectionResetError(10054, "Connessione in corso interrotta forzatamente dall'host remoto", None, 10054, None))
I follow this link and i tried to modify the updater in this way, but the problem persists:
updater = Updater(token='MYTOKEN', use_context=True, request_kwargs={'read_timeout': 6, 'connect_timeout': 7})
Running the script on my Android phone with 4G connetion, i haven't this error. So i think is my ADSL connection, maybe not stable.
What can i try to resolve this problem? Maybe modify some parameters in the updater?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|