[go: nahoru, domu]

Skip to content

Commit

Permalink
Remove use of method_whitelist when possible (#532)
Browse files Browse the repository at this point in the history
Deprecated in favor of allowed_methods. Fall back to the old argument
for older versions of urllib3 which do not support the new one.

Uses conditional attribute check as recommended in
urllib3/urllib3#2057
  • Loading branch information
xmo-odoo committed Feb 10, 2021
1 parent b35abb9 commit 8c05981
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions firebase_admin/_http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@
from requests.packages.urllib3.util import retry # pylint: disable=import-error


_ANY_METHOD = None

if hasattr(retry.Retry.DEFAULT, 'allowed_methods'):
_ANY_METHOD = {'allowed_methods': None}
else:
_ANY_METHOD = {'method_whitelist': None}
# Default retry configuration: Retries once on low-level connection and socket read errors.
# Retries up to 4 times on HTTP 500 and 503 errors, with exponential backoff. Returns the
# last response upon exhausting all retries.
DEFAULT_RETRY_CONFIG = retry.Retry(
connect=1, read=1, status=4, status_forcelist=[500, 503], method_whitelist=_ANY_METHOD,
raise_on_status=False, backoff_factor=0.5)
connect=1, read=1, status=4, status_forcelist=[500, 503],
raise_on_status=False, backoff_factor=0.5, **_ANY_METHOD)


DEFAULT_TIMEOUT_SECONDS = 120
Expand Down

0 comments on commit 8c05981

Please sign in to comment.