From 5be9fe6d5f09c0aacd2fe42ddf8f85c540d78f5e Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Sat, 8 Jul 2023 15:30:41 +0200 Subject: [PATCH 1/2] Fixed the name of parameter method_whitelist since it was changed to allowed_methods --- frameioclient/lib/transport.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameioclient/lib/transport.py b/frameioclient/lib/transport.py index 6dda6e16..81baccaf 100644 --- a/frameioclient/lib/transport.py +++ b/frameioclient/lib/transport.py @@ -49,7 +49,7 @@ def __init__(self, threads: Optional[int] = default_thread_count): total=100, backoff_factor=2, status_forcelist=retryable_statuses, - method_whitelist=["GET", "POST", "PUT", "GET", "DELETE"], + allowed_methods=["GET", "POST", "PUT", "GET", "DELETE"], ) # Create real thread From ed1049f09201e2ac916530dc6eead49ecfb788ae Mon Sep 17 00:00:00 2001 From: Oleksandr Hryshchenko Date: Sat, 8 Jul 2023 17:04:07 +0200 Subject: [PATCH 2/2] Added compatibility with older versions of urllib3 --- 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 81baccaf..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, - allowed_methods=["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()