Advanced usage of Python requests: timeouts, retries, hooks
findwork.dev
findwork.dev
The post contains the most important snippets, but you might find the advanced section of the requests docs [1] useful and the requests_toolbelt [2].
[1] https://requests.readthedocs.io/en/master/user/advanced/
It's very easy for devs to forget to think about timeouts, but inevitably that ends in a cascading production outage.
https://findwork.dev/blog/advanced-usage-python-requests-tim...
Of course, whatever it chose would inevitably be wrong for many scenarios, it would be less wrong than defaulting to waiting forever.
[1] https://github.com/psf/requests/issues/3070#issuecomment-328...
I dont see any retries on response 200: ConnectionError(ReadTimeoutError("HTTPSConnectionPool(host='domain.com', port=443): Read timed out."))
Is there a way to also retry on ChunkedEncodingError?