Advanced usage of Python requests: timeouts, retries, hooks
1–10 of 12 posts
Re: Advanced usage of Python requests: timeouts, retries, hooks
#2Re: Advanced usage of Python requests: timeouts, retries, hooks
#3Thank you for this brief reference. I'm always going back to my old projects to remind myself how I did things with requests. I didn't realize some of things existed.
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/
Re: Advanced usage of Python requests: timeouts, retries, hooks
#4It's very easy for devs to forget to think about timeouts, but inevitably that ends in a cascading production outage.
Re: Advanced usage of Python requests: timeouts, retries, hooks
#5I wish that requests had a default timeout instead of defaulting to waiting forever. 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...
Re: Advanced usage of Python requests: timeouts, retries, hooks
#6I wish that requests had a default timeout instead of defaulting to waiting forever. It's very easy for devs to forget to think about timeouts, but inevitably that ends in a cascading production outage.
I'm not sure if you noticed, but the post contains a section on how to set default timeouts. 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.
Re: Advanced usage of Python requests: timeouts, retries, hooks
#7Earlier quoted context omitted.
I'm not sure if you noticed, but the post contains a section on how to set default timeouts. https://findwork.dev/blog/advanced-usage-python-requests-tim...
Right. I'm saying the library should set a default timeout by default , which you could then change if needed. 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...
Re: Advanced usage of Python requests: timeouts, retries, hooks
#8Re: Advanced usage of Python requests: timeouts, retries, hooks
#9Thank you for this brief reference. I'm always going back to my old projects to remind myself how I did things with requests. I didn't realize some of things existed.
You're welcome. I thought I'd aggregate all the useful tricks I'd found while working on my last project. It's a collection of snippets I had found in the docs and in Github issues. 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/ [2] https://toolbelt.readth…