adafruit / Adafruit_IO_Python

Adafruit IO Python Client Library
Other
225 stars 99 forks source link

Implement exponential backoffs in Client #110

Closed brentru closed 3 years ago

brentru commented 4 years ago

Add https://urllib3.readthedocs.io/en/latest/reference/urllib3.util.html#module-urllib3.util.retry, class urllib3.util.retry.Retry with a backoff_factor


Traceback (most recent call last):
File "/home/pi/Desktop/temp_well.py", line 95, in <module>
aio.send(probe_feed.key, str(probe))
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_IO/client.py", line 154, in send_data
return self.create_data(feed, payload)
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_IO/client.py", line 254, in create_data
return Data.from_dict(self._post(path, data._asdict()))
File "/home/pi/.local/lib/python3.7/site-packages/Adafruit_IO/client.py", line 126, in _post
data=json.dumps(data))
File "/usr/lib/python3/dist-packages/requests/api.py", line 116, in post
return request('post', url, data=data, json=json, **kwargs)
File "/usr/lib/python3/dist-packages/requests/api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "/usr/lib/python3/dist-packages/requests/sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "/usr/lib/python3/dist-packages/requests/adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='io.adafruit.com', port=443): Max retries exceeded with url: /api/v2/*USERNAME*/feeds/outside/data (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0xb544fbb0>: Failed to establish a new connection: [Errno -3] Temporary failure in name resolution'))```
brentru commented 3 years ago

Not required and should be implemented on the server-side, closing.