Skip to content

Commit

Permalink
Fix incorrect implementation of respect_retry_after_header
Browse files Browse the repository at this point in the history
  • Loading branch information
jmeickle committed May 14, 2019
1 parent 7d813bc commit 3b68f18
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/urllib3/util/retry.py
Expand Up @@ -192,7 +192,8 @@ def new(self, **kw):
raise_on_redirect=self.raise_on_redirect,
raise_on_status=self.raise_on_status,
history=self.history,
remove_headers_on_redirect=self.remove_headers_on_redirect
remove_headers_on_redirect=self.remove_headers_on_redirect,
respect_retry_after_header=self.respect_retry_after_header
)
params.update(kw)
return type(self)(**params)
Expand Down Expand Up @@ -274,7 +275,7 @@ def sleep(self, response=None):
this method will return immediately.
"""

if response:
if self.respect_retry_after_header and response:
slept = self.sleep_for_retry(response)
if slept:
return
Expand Down

0 comments on commit 3b68f18

Please sign in to comment.