Skip to content

Commit

Permalink
fix(Retry): replace method_whitelist
Browse files Browse the repository at this point in the history
This parameter has been deprecated and allowed_methods param should be
used instead

Signed-off-by: Martin Basti <[email protected]>
  • Loading branch information
MartinBasti committed Sep 27, 2024
1 parent f50e7a5 commit 0c450a8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions atomic_reactor/utils/cachito.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ def __init__(self, api_url, insecure=False, cert=None, timeout=None):
self.timeout = 3600 if timeout is None else timeout

def _make_session(self, insecure, cert):
# method_whitelist=False allows retrying non-idempotent methods like POST
session = get_retrying_requests_session(method_whitelist=False)
# allowed_methods=False allows retrying non-idempotent methods like POST
session = get_retrying_requests_session(allowed_methods=False)
session.verify = not insecure
if cert:
session.cert = cert
Expand Down
4 changes: 2 additions & 2 deletions atomic_reactor/utils/odcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def __init__(self, url, insecure=False, token=None, cert=None,
self._setup_session(insecure=insecure, token=token, cert=cert, kerberos_auth=kerberos_auth)

def _setup_session(self, insecure, token, cert, kerberos_auth):
# method_whitelist=False allows retrying non-idempotent methods like POST
session = get_retrying_requests_session(method_whitelist=False)
# allowed_methods=False allows retrying non-idempotent methods like POST
session = get_retrying_requests_session(allowed_methods=False)

session.verify = not insecure

Expand Down
4 changes: 2 additions & 2 deletions atomic_reactor/utils/retries.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,15 @@ def hook_log_error_response_content(response, *args, **kwargs):

def get_retrying_requests_session(client_statuses=HTTP_CLIENT_STATUS_RETRY,
times=HTTP_MAX_RETRIES, delay=HTTP_BACKOFF_FACTOR,
method_whitelist=None, raise_on_status=True):
allowed_methods=None, raise_on_status=True):
if _http_retries_disabled():
times = 0

retry = Retry(
total=int(times),
backoff_factor=delay,
status_forcelist=client_statuses,
method_whitelist=method_whitelist
allowed_methods=allowed_methods
)

# raise_on_status was added later to Retry, adding compatibility to work
Expand Down

0 comments on commit 0c450a8

Please sign in to comment.