Support Retry.DEFAULT_BACKOFF_MAX in a backwards-compatible way

This commit is contained in:
allegroai 2023-04-10 22:54:35 +03:00
parent a794d0d8ab
commit 1980f1c56b

View File

@ -129,7 +129,10 @@ def get_http_session_with_retry(
session.trust_env = False
if backoff_max is not None:
Retry.DEFAULT_BACKOFF_MAX = backoff_max
if "BACKOFF_MAX" in vars(Retry):
Retry.BACKOFF_MAX = backoff_max
else:
Retry.DEFAULT_BACKOFF_MAX = backoff_max
retry = Retry(
total=total, connect=connect, read=read, redirect=redirect, status=status,