I am using the usual urllib3 solution for requests to have retry and timeout handling:
DEFAULT_TIMEOUT = 20 # seconds class TimeoutHTTPAdapter(HTTPAdapter):