Plurrrr

Wed 17 Aug 2022

How to Patch Requests to Have a Default Timeout

Python’s requests package is very popular. Even if you don’t use it directly, it’s highly likely one of your dependencies does.

One wrinkle in requests’ design is that it has no default timeout. This means that requests can hang forever if the remote server doesn’t respond, unless the author remembered to add a timeout. Issue #3070 tracks the discussion on adding such a default timeout, but it has been open several years. httpx learned a lesson from this and it has default timeout of five seconds.

Source: How to Patch Requests to Have a Default Timeout, an article by Adam Johnson.