Commit b32051f1 by Arun Babu Neelicattu

Ensure retry logic does not fail on empty io

parent dfa5c0f6
......@@ -40,7 +40,7 @@ class Authenticator(object):
self, method, url, **kwargs
): # type: (str, str, Any) -> requests.Response
request = requests.Request(method, url)
io = kwargs.get("io", self._io)
io = kwargs.get("io") or self._io
username, password = self._get_credentials_for_url(url)
......@@ -83,8 +83,11 @@ class Authenticator(object):
if not is_last_attempt:
attempt += 1
delay = 0.5 * attempt
if io is not None:
io.write_line(
"<debug>Retrying HTTP request in {} seconds.</debug>".format(delay)
"<debug>Retrying HTTP request in {} seconds.</debug>".format(
delay
)
)
time.sleep(delay)
continue
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment