-
Notifications
You must be signed in to change notification settings - Fork 6k
Description
Original comment:
Hello,
I've seen a similar issue here, but it did not mention that it only occurs with PTB 11.1.0 and 11.0.0.
I have downgraded PTB back to 10.1.0 to test it again and did not have a single problem, which led me to believe that it is not a network issue.
Steps to reproduce
-
pip install python-telegram-bot -U
or
pip install python-telegram-bot==11.0.0 -
start a bot with getUpdates method and logging.DEBUG
Expected behaviour
Bot should get updates
Actual behaviour
after entering getUpdates and starting HTTPS connection, telegram.ext.updater reports Timed out getting Updates: Timed out
and it goes again and again in a loop without success
It happens to be the case only with PTB version 11.0.0 and 11.1.0;
with 10.1.0 I am able to get updates without problems
Configuration
Operating System:
Win10 64bit
Version of Python, python-telegram-bot & dependencies:
python-telegram-bot 11.1.0 or python-telegram-bot 11.0.0
certifi 2018.11.29
future 0.17.1
Python 3.6.4 (i've also updated Python to 3.7.2 - issue persists)
Logs
2019-01-10 14:53:23,582 - telegram.bot - DEBUG - Entering: get_updates
2019-01-10 14:53:23,587 - telegram.vendor.ptb_urllib3.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (1): api.telegram.org
2019-01-10 14:53:28,949 - telegram.ext.updater - DEBUG - Timed out getting Updates: Timed out
2019-01-10 14:53:28,956 - telegram.bot - DEBUG - Entering: get_updates
2019-01-10 14:53:28,961 - telegram.vendor.ptb_urllib3.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (2): api.telegram.org
2019-01-10 14:53:34,320 - telegram.ext.updater - DEBUG - Timed out getting Updates: Timed out
2019-01-10 14:53:34,328 - telegram.bot - DEBUG - Entering: get_updates
2019-01-10 14:53:34,333 - telegram.vendor.ptb_urllib3.urllib3.connectionpool - DEBUG - Starting new HTTPS connection (3): api.telegram.org
2019-01-10 14:53:39,700 - telegram.ext.updater - DEBUG - Timed out getting Updates: Timed out
EDIT:
Despite DEBUG constantly showing Timed out, updates strangely enough do work!
I can only wonder why DEBUG shows this
But it does not cause any problems for me so far, so maybe it is a minor bug,
maybe even Windows only
I have an assumption this probably has something to do with .utils.response module
Can someone please confirm they have similar symptoms?
EDIT 2:
It was in fact a 413 (Request Entity Too Large) error returned by Telegram, which had nothing to do with the file size, but rather it so happened, that some of my files did not have Latin only characters in their names, and Telegram didn't like it. Please disregard this:
Uploading several large files in a row (that is, in the range of 10 to 50 mb) prompts two other errors:
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
followed by:
TelegramError: Invalid server responseThe first upload goes without problems, this happens starting from the second one.
Files less than 10mb seem to be unaffected.Can somebody please confirm having the same issues as I am?
Here is the log:
2019-01-12 01:36:40,883 - telegram.vendor.ptb_urllib3.urllib3.connectionpool - DEBUG - https://api.telegram.org:443 "POST /bot<TOKEN>/sendVideo HTTP/1.1" 413 0 Exception in thread Thread-1: Traceback (most recent call last): File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\site-packages\telegram\utils\request.py", line 157, in _parse data = json.loads(decoded_s) File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\json\__init__.py", line 348, in loads return _default_decoder.decode(s) File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\json\decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\threading.py", line 917, in _bootstrap_inner self.run() File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "C:\[DATA]\Bot\mybot.py", line 1385, in task_executor Autoposter.poster(thumbname) File "C:\[DATA]\Bot\mybot.py", line 1589, in poster timeout=5000 File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\site-packages\telegram\bot.py", line 65, in decorator result = func(self, *args, **kwargs) File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\site-packages\telegram\bot.py", line 90, in decorator result = self._request.post(url, data, timeout=kwargs.get('timeout')) File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\site-packages\telegram\utils\request.py", line 331, in post result = self._request_wrapper('POST', url, fields=data, **urlopen_kwargs) File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\site-packages\telegram\utils\request.py", line 216, in _request_wrapper message = self._parse(resp.data) File "C:\Users\username\AppData\Local\Programs\Python\Python37\lib\site-packages\telegram\utils\request.py", line 163, in _parse raise TelegramError('Invalid server response') telegram.error.TelegramError: Invalid server response