From 569297ca37fd07c1aaac80018e269b6939f5d116 Mon Sep 17 00:00:00 2001 From: Ric Evans Date: Tue, 1 Aug 2023 16:14:50 -0700 Subject: [PATCH] fix `urllib3.util.retry.Retry` import --- rest_tools/client/session.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/rest_tools/client/session.py b/rest_tools/client/session.py index 66070a24..546c2cad 100644 --- a/rest_tools/client/session.py +++ b/rest_tools/client/session.py @@ -6,27 +6,27 @@ # fmt:off # pylint: skip-file -from typing import Iterable +from typing import Collection import requests from requests.adapters import HTTPAdapter -from requests.packages.urllib3.util.retry import Retry from requests_futures.sessions import FuturesSession # type: ignore[import] +from urllib3.util.retry import Retry def AsyncSession( retries: int, backoff_factor: float, - allowed_methods: Iterable[str] = ('HEAD', 'TRACE', 'GET', 'POST', 'PUT', 'OPTIONS', 'DELETE'), - status_forcelist: Iterable[int] = (408, 429, 500, 502, 503, 504), + allowed_methods: Collection[str] = ('HEAD', 'TRACE', 'GET', 'POST', 'PUT', 'OPTIONS', 'DELETE'), + status_forcelist: Collection[int] = (408, 429, 500, 502, 503, 504), ) -> FuturesSession: """Return a Session object with full retry capabilities. Args: retries (int): number of retries backoff_factor (float): speed factor for retries (in seconds) - allowed_methods (iterable): http methods to retry on - status_forcelist (iterable): http status codes to retry on + allowed_methods (collection): http methods to retry on + status_forcelist (collection): http status codes to retry on Returns: :py:class:`requests.Session`: session object @@ -51,16 +51,16 @@ def AsyncSession( def Session( retries: int, backoff_factor: float, - allowed_methods: Iterable[str] = ('HEAD', 'TRACE', 'GET', 'POST', 'PUT', 'OPTIONS', 'DELETE'), - status_forcelist: Iterable[int] = (408, 429, 500, 502, 503, 504), + allowed_methods: Collection[str] = ('HEAD', 'TRACE', 'GET', 'POST', 'PUT', 'OPTIONS', 'DELETE'), + status_forcelist: Collection[int] = (408, 429, 500, 502, 503, 504), ) -> requests.Session: """Return a Session object with full retry capabilities. Args: retries (int): number of retries backoff_factor (float): speed factor for retries (in seconds) - allowed_methods (iterable): http methods to retry on - status_forcelist (iterable): http status codes to retry on + allowed_methods (collection): http methods to retry on + status_forcelist (collection): http status codes to retry on Returns: :py:class:`requests.Session`: session object