Given following example usage:
adapter = HTTPAdapter(max_retries=Retry(
total=5,
backoff_factor=0.1,
status_forcelist=[429, 500, 502, 503, 504],
method_whitelist=["HEAD", "GET", "OPTIONS"]
))
session = requests.Session()
session.mount("http://", adapter)
session.mount("https://", adapter)
rsp = session.post(url, json=my_json, params=my_params)
How do I tell how many retries were made? I'm trying to debug/diagnose/resolve an issue posted in this related question
Alternatively, is there a different usage of these libs that provides this?
history
of retried attempts, then that would be great. Because, if you try to accessraw.retries.history
either it will throw an exception or if the first attempt gets successfully done then it will give you an emptylist
. Withtry/except
it will then skip to theexcept
block. – Guilty