From 0fb7e8390ed5fe828f4a04d1b445e9d2471bab2b Mon Sep 17 00:00:00 2001 From: Sebastian Reategui Date: Sun, 18 Feb 2024 11:30:01 +1100 Subject: [PATCH] support newer versions of urllib3 with backwards support too. patch by someone else --- frameioclient/lib/transport.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/frameioclient/lib/transport.py b/frameioclient/lib/transport.py index 6dda6e16..b3688bda 100644 --- a/frameioclient/lib/transport.py +++ b/frameioclient/lib/transport.py @@ -45,12 +45,20 @@ def __init__(self, threads: Optional[int] = default_thread_count): self.shared_headers = {"x-frameio-client": f"python/{self.client_version}"} # Configure retry strategy (very broad right now) - self.retry_strategy = Retry( - total=100, - backoff_factor=2, - status_forcelist=retryable_statuses, - method_whitelist=["GET", "POST", "PUT", "GET", "DELETE"], - ) + try: + self.retry_strategy = Retry( + total=100, + backoff_factor=2, + status_forcelist=retryable_statuses, + allowed_methods=["GET", "POST", "PUT", "GET", "DELETE"], + ) + except TypeError: # to save compatibility with older versions of urllib3 + self.retry_strategy = Retry( + total=100, + backoff_factor=2, + status_forcelist=retryable_statuses, + method_whitelist=["GET", "POST", "PUT", "GET", "DELETE"], + ) # Create real thread self._initialize_thread()