Skip to content

Commit 6320665

Browse files
authored
[python][client] allow passing floats for _request_timeout (#9532)
* [python][client] allow passing floats for _request_timeout While several method docstrings suggested that you could pass floats for _request_timeout and the underlying urllib3.Timeout can deal with them, the code only allowed integer values so far when passed as a single number. * [python][samples] update with fix for _request_timeout type
1 parent 5bff508 commit 6320665

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

.generator/templates/api.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ class {{classname}}(object):
8080
_preload_content (bool): if False, the urllib3.HTTPResponse object
8181
will be returned without reading/decoding response data.
8282
Default is True.
83-
_request_timeout (float/tuple): timeout setting for this request. If one
84-
number provided, it will be total request timeout. It can also
83+
_request_timeout (int/float/tuple): timeout setting for this request. If
84+
one number provided, it will be total request timeout. It can also
8585
be a pair (tuple) of (connection, read) timeouts.
8686
Default is None.
8787
_check_input_type (bool): specifies if type checking

.generator/templates/api_client.mustache

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ class ApiClient(object):
127127
_return_http_data_only: typing.Optional[bool] = None,
128128
collection_formats: typing.Optional[typing.Dict[str, str]] = None,
129129
_preload_content: bool = True,
130-
_request_timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
130+
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
131131
_host: typing.Optional[str] = None,
132132
_check_type: typing.Optional[bool] = None
133133
):
@@ -359,7 +359,7 @@ class ApiClient(object):
359359
_return_http_data_only: typing.Optional[bool] = None,
360360
collection_formats: typing.Optional[typing.Dict[str, str]] = None,
361361
_preload_content: bool = True,
362-
_request_timeout: typing.Optional[typing.Union[int, typing.Tuple]] = None,
362+
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
363363
_host: typing.Optional[str] = None,
364364
_check_type: typing.Optional[bool] = None
365365
):
@@ -695,7 +695,7 @@ class Endpoint(object):
695695
'async_req': (bool,),
696696
'_host_index': (none_type, int),
697697
'_preload_content': (bool,),
698-
'_request_timeout': (none_type, int, (int,), [int]),
698+
'_request_timeout': (none_type, float, (float,), [float], int, (int,), [int]),
699699
'_return_http_data_only': (bool,),
700700
'_check_input_type': (bool,),
701701
'_check_return_type': (bool,)

0 commit comments

Comments
 (0)