Commit 1f8915c5c88b85405e6490fef7479672e83b2002
Committed by
GitHub
Merge pull request #661 from ivanka12/412
update retry_if_request_failed
Showing
1 changed file
with
4 additions
and
6 deletions
| @@ -11,12 +11,10 @@ import os | @@ -11,12 +11,10 @@ import os | ||
| 11 | import urllib | 11 | import urllib |
| 12 | 12 | ||
| 13 | def retry_if_request_failed(exception): | 13 | def retry_if_request_failed(exception): |
| 14 | - if isinstance(exception, RequestFailed): | ||
| 15 | - status_code = getattr(exception, 'status_int', None) | ||
| 16 | - if 500 <= status_code < 600 or status_code in (409, 429): | ||
| 17 | - return True | ||
| 18 | - else: | ||
| 19 | - return False | 14 | + status_code = getattr(exception, 'status_code', None) |
| 15 | + print(status_code) | ||
| 16 | + if 500 <= status_code < 600 or status_code in (409, 429, 412): | ||
| 17 | + return True | ||
| 20 | else: | 18 | else: |
| 21 | return isinstance(exception, BadStatusLine) | 19 | return isinstance(exception, BadStatusLine) |
| 22 | 20 |
Please
register
or
login
to post a comment