Created
April 1, 2014 08:18
-
-
Save Lukasa/9910010 to your computer and use it in GitHub Desktop.
Example of setting global timeout in requests.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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