Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Read timed out while calling apptoogoodtogo.com #43

Open
F4bsi opened this issue Apr 14, 2022 · 3 comments
Open

Read timed out while calling apptoogoodtogo.com #43

F4bsi opened this issue Apr 14, 2022 · 3 comments

Comments

@F4bsi
Copy link

F4bsi commented Apr 14, 2022

Hey,

first of all thank you for your work!
Since recently everything was working great, but now I always get a timeout:

requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='apptoogoodtogo.com', port=443): Read timed out. (read timeout=30)

Not sure what changed, but my raspberry is also running low on ram, so maybe that could also be an issue? I guess we could also increase the timeout, but 30 seconds already seems like a lot. Maybe my client is blocked? The normal app on my smart phone is still working.

Full Log

[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 00-banner.sh: executing... 
-----------------------------------------------------------
 Add-on: TooGoodToGo Home Assistant MQTT Bridge
 Publish TooGoodToGo stock as MQTT messages
-----------------------------------------------------------
 Add-on version: 2.0.0
 You are running the latest version of this add-on.
 System: Home Assistant OS 7.6  (armv7 / raspberrypi3)
 Home Assistant Core: 2022.4.2
 Home Assistant Supervisor: 2022.04.0
-----------------------------------------------------------
 Please, share the above information when looking for help
 or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
[cont-init.d] 00-banner.sh: exited 0.
[cont-init.d] 01-log-level.sh: executing... 
[cont-init.d] 01-log-level.sh: exited 0.
[cont-init.d] toogoodtogo-ha-mqtt-bridge.sh: executing... 
[10:32:23] INFO: Copy setings file
No saved tokens found. 
Please make sure to check your email for the login request and answer quickly.
You can't open it on a mobile phone where the TGTG app itself is installed.
[cont-init.d] toogoodtogo-ha-mqtt-bridge.sh: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[10:32:23] INFO: Strating Bridge...
2022-04-14 10:32:27 [INFO] Connecting mqtt
2022-04-14 10:32:27 [INFO] Starting loop
2022-04-14 10:32:27 [DEBUG] Logging in with credentials
2022-04-14 10:33:20 [DEBUG] Written tokens.json file to filesystem
2022-04-14 10:33:20 [DEBUG] Next run at 2022-04-14 10:45:26
2022-04-14 10:45:26 [DEBUG] Loop run started
Exception in thread Thread-3:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 449, in _make_request
    six.raise_from(e, None)
  File "<string>", line 3, in raise_from
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 444, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/local/lib/python3.8/http/client.py", line 1347, in getresponse
    response.begin()
  File "/usr/local/lib/python3.8/http/client.py", line 307, in begin
    version, status, reason = self._read_status()
  File "/usr/local/lib/python3.8/http/client.py", line 268, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/usr/local/lib/python3.8/socket.py", line 669, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/lib/python3.8/ssl.py", line 1241, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/lib/python3.8/ssl.py", line 1099, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 439, in send
    resp = conn.urlopen(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "/usr/local/lib/python3.8/site-packages/urllib3/util/retry.py", line 550, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.8/site-packages/urllib3/packages/six.py", line 770, in reraise
    raise value
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 703, in urlopen
    httplib_response = self._make_request(
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 451, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/usr/local/lib/python3.8/site-packages/urllib3/connectionpool.py", line 340, in _raise_timeout
    raise ReadTimeoutError(
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='apptoogoodtogo.com', port=443): Read timed out. (read timeout=30)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/app/toogoodtogo_ha_mqtt_bridge/main.py", line 213, in loop
    if not check():
  File "/app/toogoodtogo_ha_mqtt_bridge/main.py", line 37, in check
    shops = tgtg_client.get_items(page_size=400)
  File "/usr/local/lib/python3.8/site-packages/tgtg/__init__.py", line 225, in get_items
    response = self.session.post(
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 590, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 542, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/sessions.py", line 655, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/requests/adapters.py", line 529, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='apptoogoodtogo.com', port=443): Read timed out. (read timeout=30)

@MaxWinterstein
Copy link
Owner

Is this still a thing for you?

@Fabian-Eigenherd
Copy link

Hey, yes I still have that problem sometimes. But havnt updatet to the latest version yet

@MaxWinterstein
Copy link
Owner

phew, not sure what I can do for you at that point.

Running low on memory always is a big issue. When the raspberry is starting to swap (aka writing/reading memory to/from disk) normally everything starts to act totally weird...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants