Skip to content

Instantly share code, notes, and snippets.

@Lukasa
Created April 1, 2014 08:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Lukasa/9910010 to your computer and use it in GitHub Desktop.
Save Lukasa/9910010 to your computer and use it in GitHub Desktop.
Example of setting global timeout in requests.
from requests.adapters import HTTPAdapter
class TimeoutAdapter(HTTPAdapter):
def send(self, *args, **kwargs):
kwargs.setdefault('timeout', 30)
super(TimeoutAdapter, self).send(*args, **kwargs)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment