datashaman

Untitled

Feb 25th, 2016
610
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import logging
  2. import requests
  3.  
  4. from requests.adapters import HTTPAdapter
  5. from requests.packages.urllib3.util.retry import Retry
  6.  
  7. logging.basicConfig(level=logging.DEBUG)
  8.  
  9. s = requests.Session()
  10. retries = Retry(total=5, backoff_factor=0.1, status_forcelist=[ 500, 502, 503, 504 ])
  11. s.mount('http://', HTTPAdapter(max_retries=retries))
  12. s.get("http://httpstat.us/503")
RAW Paste Data