Hey! First of all: Thank you for yout great app. I'm using it a lot, made some changes and normally it works very good. But there is one problem from time to time, that the API Call limit is reached and I don't know why. In the log there are some error codes, I don't understand. First, here is the code out of my syslog. I also changed some code in the app.py like the facebook sdk version (I use 3.1) and some linking things, but I don't think they interference with the APP Call limit (I also changed it to 3:50 from 3:40):
Dec 3 10:39:20 74213 app.py[4659]: 2018-12-03 10:39:20,457 - apscheduler.executors.default - INFO - Job "fetch (trigger: interval[0:03:50], next run at: 2018-12-03 11:43:07 EET)" executed successfully Dec 3 10:43:07 74213 app.py[4659]: 2018-12-03 10:43:07,910 - apscheduler.executors.default - INFO - Running job "fetch (trigger: interval[0:03:50], next run at: 2018-12-03 11:46:57 EET)" (scheduled at 2018-12-03 11:43:07.909630+02:00) Dec 3 10:43:15 74213 app.py[4659]: 2018-12-03 10:43:15,805 - apscheduler.executors.default - ERROR - Job "fetch (trigger: interval[0:03:50], next run at: 2018-12-03 11:46:57 EET)" raised an exception Dec 3 10:43:15 74213 app.py[4659]: Traceback (most recent call last): Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 402, in _make_request Dec 3 10:43:15 74213 app.py[4659]: six.raise_from(e, None) Dec 3 10:43:15 74213 app.py[4659]: File "<string>", line 2, in raise_from Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 398, in _make_request Dec 3 10:43:15 74213 app.py[4659]: httplib_response = conn.getresponse() Dec 3 10:43:15 74213 app.py[4659]: File "/usr/lib/python3.5/http/client.py", line 1198, in getresponse Dec 3 10:43:15 74213 app.py[4659]: response.begin() Dec 3 10:43:15 74213 app.py[4659]: File "/usr/lib/python3.5/http/client.py", line 297, in begin Dec 3 10:43:15 74213 app.py[4659]: version, status, reason = self._read_status() Dec 3 10:43:15 74213 app.py[4659]: File "/usr/lib/python3.5/http/client.py", line 258, in _read_status Dec 3 10:43:15 74213 app.py[4659]: line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1") Dec 3 10:43:15 74213 app.py[4659]: File "/usr/lib/python3.5/socket.py", line 576, in readinto Dec 3 10:43:15 74213 app.py[4659]: return self._sock.recv_into(b) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/lib/python3.5/ssl.py", line 937, in recv_into Dec 3 10:43:15 74213 app.py[4659]: return self.read(nbytes, buffer) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/lib/python3.5/ssl.py", line 799, in read Dec 3 10:43:15 74213 app.py[4659]: return self._sslobj.read(len, buffer) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/lib/python3.5/ssl.py", line 583, in read Dec 3 10:43:15 74213 app.py[4659]: v = self._sslobj.read(len, buffer) Dec 3 10:43:15 74213 app.py[4659]: socket.timeout: The read operation timed out Dec 3 10:43:15 74213 app.py[4659]: During handling of the above exception, another exception occurred: Dec 3 10:43:15 74213 app.py[4659]: Traceback (most recent call last): Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 203, in _request_wrapper Dec 3 10:43:15 74213 app.py[4659]: resp = self._con_pool.request(*args, **kwargs) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request Dec 3 10:43:15 74213 app.py[4659]: **urlopen_kw) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body Dec 3 10:43:15 74213 app.py[4659]: return self.urlopen(method, url, **extra_kw) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen Dec 3 10:43:15 74213 app.py[4659]: response = conn.urlopen(method, u.request_uri, **kw) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen Dec 3 10:43:15 74213 app.py[4659]: _stacktrace=sys.exc_info()[2]) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment Dec 3 10:43:15 74213 app.py[4659]: raise six.reraise(type(error), error, _stacktrace) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 686, in reraise Dec 3 10:43:15 74213 app.py[4659]: raise value Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen Dec 3 10:43:15 74213 app.py[4659]: chunked=chunked) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 405, in _make_request Dec 3 10:43:15 74213 app.py[4659]: exc_cls=ReadTimeoutError) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 321, in _raise_timeout Dec 3 10:43:15 74213 app.py[4659]: raise exc_cls(*args) Dec 3 10:43:15 74213 app.py[4659]: telegram.vendor.ptb_urllib3.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.telegram.org', port=443): Read timed out. (read timeout=5.0) Dec 3 10:43:15 74213 app.py[4659]: During handling of the above exception, another exception occurred: Dec 3 10:43:15 74213 app.py[4659]: Traceback (most recent call last): Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/apscheduler/executors/base.py", line 125, in run_job Dec 3 10:43:15 74213 app.py[4659]: retval = job.func(*job.args, **job.kwargs) Dec 3 10:43:15 74213 app.py[4659]: File "/root/telegrambot/app.py", line 142, in fetch Dec 3 10:43:15 74213 app.py[4659]: bot.send_message(chat_id=chatids, text="Your facebook user access token might have expired") Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/bot.py", line 65, in decorator Dec 3 10:43:15 74213 app.py[4659]: result = func(self, *args, **kwargs) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/bot.py", line 90, in decorator Dec 3 10:43:15 74213 app.py[4659]: result = self._request.post(url, data, timeout=kwargs.get('timeout')) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 309, in post Dec 3 10:43:15 74213 app.py[4659]: headers={'Content-Type': 'application/json'}) Dec 3 10:43:15 74213 app.py[4659]: File "/usr/local/lib/python3.5/dist-packages/telegram/utils/request.py", line 205, in _request_wrapper Dec 3 10:43:15 74213 app.py[4659]: raise TimedOut() Dec 3 10:43:15 74213 app.py[4659]: telegram.error.TimedOut: Timed out Dec 3 10:46:57 74213 app.py[4659]: 2018-12-03 10:46:57,910 - apscheduler.executors.default - INFO - Running job "fetch (trigger: interval[0:03:50], next run at: 2018-12-03 11:50:47 EET)" (scheduled at 2018-12-03 11:46:57.909630+02:00)
Perhaps you understand the errors out of the syslog. When I go to facebook it also shows me that the call count is about 101% at the moment - so it blocks every new call (and also the bot is sending me "Your facebook token might have expired" every call/3:50minute. The token is a never expiring token.
Thank you!
David