Skip to content

Commit

Permalink
head requests: better retry strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
adbar committed Apr 19, 2023
1 parent b13571f commit 968fd5d
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions courlan/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,29 @@
LOGGER = logging.getLogger(__name__)

RETRY_STRATEGY = urllib3.util.Retry(
total=5,
redirect=5,
total=2,
redirect=2,
raise_on_redirect=False,
status_forcelist=[
429,
499,
500,
502,
503,
504,
509,
520,
521,
522,
523,
524,
525,
526,
527,
530,
598,
], # unofficial: https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#Unofficial_codes
backoff_factor=1,
)
HTTP_POOL = urllib3.PoolManager(retries=RETRY_STRATEGY)

Expand Down

0 comments on commit 968fd5d

Please sign in to comment.