Last active
August 21, 2022 03:58
-
-
Save Cologler/6d64555f801f4631a96c9efad61358f8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# copied from https://stackoverflow.com/questions/17782142/ | |
def patch_requests_timeout(default_timeout: float) -> None: | |
import requests | |
old_send = requests.Session.send | |
def new_send(*args, **kwargs): | |
if kwargs.get("timeout", None) is None: | |
kwargs["timeout"] = default_timeout | |
return old_send(*args, **kwargs) | |
requests.Session.send = new_send |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment