Skip to content

Instantly share code, notes, and snippets.

@abhirama
Created March 31, 2020 07:33
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 abhirama/aeb85a6660745f5b843315e2e5c588a3 to your computer and use it in GitHub Desktop.
Save abhirama/aeb85a6660745f5b843315e2e5c588a3 to your computer and use it in GitHub Desktop.
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