Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,20 @@ class RESTClientObject:
self.proxy = configuration.proxy
self.proxy_headers = configuration.proxy_headers

self.retries = configuration.retries
retries = configuration.retries
if retries is None:
self._effective_retry_options = None
elif isinstance(retries, aiohttp_retry.RetryOptionsBase):
self._effective_retry_options = retries
elif isinstance(retries, int):
self._effective_retry_options = aiohttp_retry.ExponentialRetry(
attempts=retries,
factor=2.0,
start_timeout=0.1,
max_timeout=120.0
)
else:
self._effective_retry_options = None
Comment thread
wing328 marked this conversation as resolved.

self.pool_manager: Optional[aiohttp.ClientSession] = None
self.retry_client: Optional[aiohttp_retry.RetryClient] = None
Expand Down Expand Up @@ -191,16 +204,11 @@ class RESTClientObject:
)
pool_manager = self.pool_manager

if self.retries is not None and method in ALLOW_RETRY_METHODS:
if self._effective_retry_options is not None and method in ALLOW_RETRY_METHODS:
if self.retry_client is None:
self.retry_client = aiohttp_retry.RetryClient(
client_session=self.pool_manager,
retry_options=aiohttp_retry.ExponentialRetry(
attempts=self.retries,
factor=2.0,
start_timeout=0.1,
max_timeout=120.0
)
retry_options=self._effective_retry_options
)
pool_manager = self.retry_client

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param retries: Retry config; type depends on library:
* urllib3: int | urllib3.util.retry.Retry
Comment thread
timonrieger marked this conversation as resolved.
Outdated
* asyncio: int | aiohttp_retry.RetryOptionsBase
Comment thread
timonrieger marked this conversation as resolved.
Outdated
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
Expand Down Expand Up @@ -298,7 +300,7 @@ conf = {{{packageName}}}.Configuration(
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
retries: Optional[Union[int, Any]] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
Expand Down Expand Up @@ -432,7 +434,7 @@ conf = {{{packageName}}}.Configuration(
"""Safe chars for path_param
"""
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param retries: Retry config; type depends on library:
* urllib3: int | urllib3.util.retry.Retry
* asyncio: int | aiohttp_retry.RetryOptionsBase
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
Expand Down Expand Up @@ -203,7 +205,7 @@ def __init__(
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
retries: Optional[Union[int, Any]] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
Expand Down Expand Up @@ -320,7 +322,7 @@ def __init__(
"""Safe chars for path_param
"""
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,9 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param retries: Retry config; type depends on library:
* urllib3: int | urllib3.util.retry.Retry
* asyncio: int | aiohttp_retry.RetryOptionsBase
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
Expand Down Expand Up @@ -203,7 +205,7 @@ def __init__(
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
retries: Optional[Union[int, Any]] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
Expand Down Expand Up @@ -320,7 +322,7 @@ def __init__(
"""Safe chars for path_param
"""
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param retries: Retry config; type depends on library:
* urllib3: int | urllib3.util.retry.Retry
* asyncio: int | aiohttp_retry.RetryOptionsBase
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
Expand Down Expand Up @@ -267,7 +269,7 @@ def __init__(
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
retries: Optional[Union[int, Any]] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
Expand Down Expand Up @@ -385,7 +387,7 @@ def __init__(
"""Safe chars for path_param
"""
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,20 @@ def __init__(self, configuration) -> None:
self.proxy = configuration.proxy
self.proxy_headers = configuration.proxy_headers

self.retries = configuration.retries
retries = configuration.retries
if retries is None:
self._effective_retry_options = None
elif isinstance(retries, aiohttp_retry.RetryOptionsBase):
self._effective_retry_options = retries
elif isinstance(retries, int):
self._effective_retry_options = aiohttp_retry.ExponentialRetry(
attempts=retries,
factor=2.0,
start_timeout=0.1,
max_timeout=120.0
)
else:
self._effective_retry_options = None

self.pool_manager: Optional[aiohttp.ClientSession] = None
self.retry_client: Optional[aiohttp_retry.RetryClient] = None
Expand Down Expand Up @@ -200,16 +213,11 @@ async def request(
)
pool_manager = self.pool_manager

if self.retries is not None and method in ALLOW_RETRY_METHODS:
if self._effective_retry_options is not None and method in ALLOW_RETRY_METHODS:
if self.retry_client is None:
self.retry_client = aiohttp_retry.RetryClient(
client_session=self.pool_manager,
retry_options=aiohttp_retry.ExponentialRetry(
attempts=self.retries,
factor=2.0,
start_timeout=0.1,
max_timeout=120.0
)
retry_options=self._effective_retry_options
)
pool_manager = self.retry_client

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param retries: Retry config; type depends on library:
* urllib3: int | urllib3.util.retry.Retry
* asyncio: int | aiohttp_retry.RetryOptionsBase
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
Expand Down Expand Up @@ -267,7 +269,7 @@ def __init__(
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
retries: Optional[Union[int, Any]] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
Expand Down Expand Up @@ -385,7 +387,7 @@ def __init__(
"""Safe chars for path_param
"""
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param retries: Retry config; type depends on library:
* urllib3: int | urllib3.util.retry.Retry
* asyncio: int | aiohttp_retry.RetryOptionsBase
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
Expand Down Expand Up @@ -268,7 +270,7 @@ def __init__(
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
retries: Optional[Union[int, Any]] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
Expand Down Expand Up @@ -390,7 +392,7 @@ def __init__(
"""Safe chars for path_param
"""
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,9 @@ class Configuration:
values before.
:param ssl_ca_cert: str - the path to a file of concatenated CA certificates
in PEM format.
:param retries: Number of retries for API requests.
:param retries: Retry config; type depends on library:
* urllib3: int | urllib3.util.retry.Retry
* asyncio: int | aiohttp_retry.RetryOptionsBase
:param ca_cert_data: verify the peer using concatenated CA certificate data
in PEM (str) or DER (bytes) format.
:param cert_file: the path to a client certificate file, for mTLS.
Expand Down Expand Up @@ -268,7 +270,7 @@ def __init__(
server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None,
ignore_operation_servers: bool=False,
ssl_ca_cert: Optional[str]=None,
retries: Optional[int] = None,
retries: Optional[Union[int, Any]] = None,
ca_cert_data: Optional[Union[str, bytes]] = None,
cert_file: Optional[str]=None,
key_file: Optional[str]=None,
Expand Down Expand Up @@ -390,7 +392,7 @@ def __init__(
"""Safe chars for path_param
"""
self.retries = retries
"""Adding retries to override urllib3 default value 3
"""Retry configuration
"""
# Enable client side validation
self.client_side_validation = True
Expand Down
Loading