Timeout
Maximum waiting time for a response. If the server does not respond within this time, the request is terminated with an error.
Why
- To avoid hanging indefinitely on an unresponsive server;
- To process bulk tasks faster;
- To avoid accumulating hanging connections.
In Python
requests.get(url, timeout=30) # 30 seconds
Relation to retry
Timeout and retry work together: if there is no response within N seconds, try again.