Created
March 31, 2020 07:33
-
-
Save abhirama/aeb85a6660745f5b843315e2e5c588a3 to your computer and use it in GitHub Desktop.
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
import requests | |
from urllib3.util.retry import Retry | |
from requests.adapters import HTTPAdapter | |
import logging | |
logging.basicConfig(level=logging.DEBUG) | |
s = requests.Session() | |
retries = Retry(total=3, | |
backoff_factor=0.1, | |
status_forcelist=[500]) | |
s.mount("https://", HTTPAdapter(max_retries=retries)) | |
s.get("https://httpbin.org/status/500") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment