Http request with session and retry

from requests.packages.urllib3.util import Retry from requests.adapters import HTTPAdapter from requests import Session url_base = "htpp://www.foo.foo" url = "http://www.foo.foo/foo.html" s = Session() s.mount(url_base, HTTPAdapter(max_retries=Retry(total=10, status_forcelist=[500, 503, 408], backoff_factor=1))) r = s.get(url)

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.