From 87a5182c24cce319d6a2e4d8d74ff9a38d570f36 Mon Sep 17 00:00:00 2001 From: LeComptoirDesPharmacies Date: Sun, 20 Mar 2022 21:12:59 +0100 Subject: [PATCH] [Python] - Migrate enable per request authentification in new python codegen (#11279) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * LDS-2166 : add request auth to api client and api call Can now overwrite request auth by request Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : Add samples Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : fix test Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : Fixing test in python_disallowAdditionalPropertiesIfNotPresent Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : add removed line break Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : add name for _request_auth params Add None when _content_type is not set Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : add tabulation Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : fix missing values Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * LDS-2166 : generate sample Add _request_auth in sample Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * Request auth can now use multiple auth Request auth is now a list of dict Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten * Add request_auths in test Envoyé depuis mon iPhone. P.S. : Ce commit est certifié sans gluten Co-authored-by: Géry THRASIBULE --- .../src/main/resources/python/api.mustache | 5 + .../main/resources/python/api_client.mustache | 72 +++++---- .../petstore_api/api/another_fake_api.py | 5 + .../python/petstore_api/api/fake_api.py | 80 ++++++++++ .../api/fake_classname_tags123_api.py | 5 + .../api/fake_classname_tags_123_api.py | 5 + .../python/petstore_api/api/pet_api.py | 45 ++++++ .../python/petstore_api/api/store_api.py | 20 +++ .../python/petstore_api/api/user_api.py | 40 +++++ .../python/petstore_api/api_client.py | 58 +++++--- .../petstore/python/test/test_fake_api.py | 1 + .../petstore_api/api/another_fake_api.py | 5 + .../petstore_api/api/fake_api.py | 80 ++++++++++ .../api/fake_classname_tags123_api.py | 5 + .../api/fake_classname_tags_123_api.py | 5 + .../petstore_api/api/pet_api.py | 45 ++++++ .../petstore_api/api/store_api.py | 20 +++ .../petstore_api/api/user_api.py | 40 +++++ .../petstore_api/api_client.py | 58 +++++--- .../test/test_fake_api.py | 1 + .../python/x_auth_id_alias/api/usage_api.py | 20 +++ .../python/x_auth_id_alias/api_client.py | 58 +++++--- .../python/dynamic_servers/api/usage_api.py | 10 ++ .../python/dynamic_servers/api_client.py | 58 +++++--- .../petstore_api/api/another_fake_api.py | 5 + .../python/petstore_api/api/default_api.py | 5 + .../python/petstore_api/api/fake_api.py | 140 ++++++++++++++++++ .../api/fake_classname_tags123_api.py | 5 + .../api/fake_classname_tags_123_api.py | 5 + .../python/petstore_api/api/pet_api.py | 35 +++++ .../python/petstore_api/api/store_api.py | 20 +++ .../python/petstore_api/api/user_api.py | 40 +++++ .../python/petstore_api/api_client.py | 72 +++++---- 33 files changed, 940 insertions(+), 128 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index 3406400b4b5..a9021cff5aa 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -280,6 +280,10 @@ class {{classname}}(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -311,6 +315,7 @@ class {{classname}}(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) {{#requiredParams}} kwargs['{{paramName}}'] = \ {{paramName}} diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 15c95fabb04..890e813beee 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -130,7 +130,8 @@ class ApiClient(object): _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None + _content_type: typing.Optional[str] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): config = self.configuration @@ -180,7 +181,8 @@ class ApiClient(object): # auth setting self.update_params_for_auth(header_params, query_params, - auth_settings, resource_path, method, body) + auth_settings, resource_path, method, body, + request_auths=_request_auths) # request url if _host is None: @@ -362,7 +364,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): """Makes the HTTP request (synchronous) and returns deserialized data. @@ -410,6 +413,10 @@ class ApiClient(object): :param _check_type: boolean describing if the data back from the server should have its type checked. :type _check_type: bool, optional + :param _request_auths: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auths: list, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -424,7 +431,7 @@ class ApiClient(object): response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, - _check_type) + _check_type, _request_auths=_request_auths) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -437,7 +444,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host, _check_type)) + _host, _check_type, None, _request_auths)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -609,7 +616,7 @@ class ApiClient(object): return content_types[0] def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body): + resource_path, method, body, request_auths=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -619,33 +626,43 @@ class ApiClient(object): :param method: A string representation of the HTTP request method. :param body: A object representing the body of the HTTP request. The object type is the return value of _encoder.default(). + :param request_auths: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auths: + for auth_setting in request_auths: + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + return + for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + + def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting): + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] {{#hasHttpSignatureMethods}} - else: - # The HTTP signature scheme requires multiple HTTP headers - # that are calculated dynamically. - signing_info = self.configuration.signing_info - auth_headers = signing_info.get_http_signature_headers( - resource_path, method, headers, body, queries) - headers.update(auth_headers) + else: + # The HTTP signature scheme requires multiple HTTP headers + # that are calculated dynamically. + signing_info = self.configuration.signing_info + auth_headers = signing_info.get_http_signature_headers( + resource_path, method, headers, body, queries) + headers.update(auth_headers) {{/hasHttpSignatureMethods}} - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) class Endpoint(object): @@ -695,7 +712,8 @@ class Endpoint(object): '_check_input_type', '_check_return_type', '_content_type', - '_spec_property_naming' + '_spec_property_naming', + '_request_auths' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -710,7 +728,8 @@ class Endpoint(object): '_check_input_type': (bool,), '_check_return_type': (bool,), '_spec_property_naming': (bool,), - '_content_type': (none_type, str) + '_content_type': (none_type, str), + '_request_auths': (none_type, list) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -885,4 +904,5 @@ class Endpoint(object): _preload_content=kwargs['_preload_content'], _request_timeout=kwargs['_request_timeout'], _host=_host, + _request_auths=kwargs['_request_auths'], collection_formats=params['collection_format']) diff --git a/samples/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/client/petstore/python/petstore_api/api/another_fake_api.py index 093a4ca6a33..d54ded04e31 100644 --- a/samples/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/another_fake_api.py @@ -129,6 +129,10 @@ class AnotherFakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -160,6 +164,7 @@ class AnotherFakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.call_123_test_special_tags_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python/petstore_api/api/fake_api.py b/samples/client/petstore/python/petstore_api/api/fake_api.py index f630549347f..98536575b07 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_api.py @@ -1142,6 +1142,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1173,6 +1177,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.array_model_endpoint.call_with_http_info(**kwargs) def boolean( @@ -1216,6 +1221,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1247,6 +1256,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.boolean_endpoint.call_with_http_info(**kwargs) def create_xml_item( @@ -1292,6 +1302,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1323,6 +1337,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['xml_item'] = \ xml_item return self.create_xml_item_endpoint.call_with_http_info(**kwargs) @@ -1368,6 +1383,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1399,6 +1418,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.number_with_validations_endpoint.call_with_http_info(**kwargs) def object_model_with_ref_props( @@ -1442,6 +1462,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1473,6 +1497,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.object_model_with_ref_props_endpoint.call_with_http_info(**kwargs) def string( @@ -1516,6 +1541,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1547,6 +1576,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.string_endpoint.call_with_http_info(**kwargs) def string_enum( @@ -1590,6 +1620,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1621,6 +1655,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.string_enum_endpoint.call_with_http_info(**kwargs) def test_body_with_file_schema( @@ -1666,6 +1701,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1697,6 +1736,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.test_body_with_file_schema_endpoint.call_with_http_info(**kwargs) @@ -1745,6 +1785,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1776,6 +1820,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['query'] = \ query kwargs['body'] = \ @@ -1825,6 +1870,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1856,6 +1905,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.test_client_model_endpoint.call_with_http_info(**kwargs) @@ -1911,6 +1961,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1942,6 +1996,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['query_integer'] = \ query_integer kwargs['query_string'] = \ @@ -2013,6 +2068,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2044,6 +2103,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['number'] = \ number kwargs['double'] = \ @@ -2102,6 +2162,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2133,6 +2197,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.test_enum_parameters_endpoint.call_with_http_info(**kwargs) def test_group_parameters( @@ -2185,6 +2250,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2216,6 +2285,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['required_string_group'] = \ required_string_group kwargs['required_boolean_group'] = \ @@ -2266,6 +2336,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2297,6 +2371,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['param'] = \ param return self.test_inline_additional_properties_endpoint.call_with_http_info(**kwargs) @@ -2345,6 +2420,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2376,6 +2455,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['param'] = \ param kwargs['param2'] = \ diff --git a/samples/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py b/samples/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py index 70b4a535a81..e6abced8409 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py @@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.test_classname_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index 70b4a535a81..69537296f48 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auth (dict): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auth'] = kwargs.get('_request_auth', None) kwargs['body'] = \ body return self.test_classname_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python/petstore_api/api/pet_api.py b/samples/client/petstore/python/petstore_api/api/pet_api.py index 290bf04cf1e..af164a6ce79 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -594,6 +594,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -625,6 +629,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.add_pet_endpoint.call_with_http_info(**kwargs) @@ -672,6 +677,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -703,6 +712,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.delete_pet_endpoint.call_with_http_info(**kwargs) @@ -750,6 +760,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -781,6 +795,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['status'] = \ status return self.find_pets_by_status_endpoint.call_with_http_info(**kwargs) @@ -828,6 +843,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -859,6 +878,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['tags'] = \ tags return self.find_pets_by_tags_endpoint.call_with_http_info(**kwargs) @@ -906,6 +926,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -937,6 +961,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.get_pet_by_id_endpoint.call_with_http_info(**kwargs) @@ -983,6 +1008,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1014,6 +1043,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.update_pet_endpoint.call_with_http_info(**kwargs) @@ -1062,6 +1092,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1093,6 +1127,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.update_pet_with_form_endpoint.call_with_http_info(**kwargs) @@ -1142,6 +1177,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1173,6 +1212,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.upload_file_endpoint.call_with_http_info(**kwargs) @@ -1222,6 +1262,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1253,6 +1297,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id kwargs['required_file'] = \ diff --git a/samples/client/petstore/python/petstore_api/api/store_api.py b/samples/client/petstore/python/petstore_api/api/store_api.py index a1172b1f10e..98e47ccdf86 100644 --- a/samples/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/client/petstore/python/petstore_api/api/store_api.py @@ -275,6 +275,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -306,6 +310,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['order_id'] = \ order_id return self.delete_order_endpoint.call_with_http_info(**kwargs) @@ -350,6 +355,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -381,6 +390,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.get_inventory_endpoint.call_with_http_info(**kwargs) def get_order_by_id( @@ -426,6 +436,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -457,6 +471,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['order_id'] = \ order_id return self.get_order_by_id_endpoint.call_with_http_info(**kwargs) @@ -503,6 +518,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -534,6 +553,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.place_order_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python/petstore_api/api/user_api.py b/samples/client/petstore/python/petstore_api/api/user_api.py index 6eabc2a0a01..5f396434292 100644 --- a/samples/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/client/petstore/python/petstore_api/api/user_api.py @@ -462,6 +462,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -493,6 +497,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.create_user_endpoint.call_with_http_info(**kwargs) @@ -539,6 +544,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -570,6 +579,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.create_users_with_array_input_endpoint.call_with_http_info(**kwargs) @@ -616,6 +626,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -647,6 +661,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.create_users_with_list_input_endpoint.call_with_http_info(**kwargs) @@ -694,6 +709,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -725,6 +744,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username return self.delete_user_endpoint.call_with_http_info(**kwargs) @@ -771,6 +791,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -802,6 +826,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username return self.get_user_by_name_endpoint.call_with_http_info(**kwargs) @@ -850,6 +875,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -881,6 +910,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username kwargs['password'] = \ @@ -926,6 +956,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -957,6 +991,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.logout_user_endpoint.call_with_http_info(**kwargs) def update_user( @@ -1004,6 +1039,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1035,6 +1074,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username kwargs['body'] = \ diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index da37b066d3a..e283cf092d7 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -132,7 +132,8 @@ class ApiClient(object): _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None + _content_type: typing.Optional[str] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): config = self.configuration @@ -182,7 +183,8 @@ class ApiClient(object): # auth setting self.update_params_for_auth(header_params, query_params, - auth_settings, resource_path, method, body) + auth_settings, resource_path, method, body, + request_auths=_request_auths) # request url if _host is None: @@ -350,7 +352,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): """Makes the HTTP request (synchronous) and returns deserialized data. @@ -398,6 +401,10 @@ class ApiClient(object): :param _check_type: boolean describing if the data back from the server should have its type checked. :type _check_type: bool, optional + :param _request_auths: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auths: list, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -412,7 +419,7 @@ class ApiClient(object): response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, - _check_type) + _check_type, _request_auths=_request_auths) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -425,7 +432,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host, _check_type)) + _host, _check_type, None, _request_auths)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -597,7 +604,7 @@ class ApiClient(object): return content_types[0] def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body): + resource_path, method, body, request_auths=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -607,24 +614,34 @@ class ApiClient(object): :param method: A string representation of the HTTP request method. :param body: A object representing the body of the HTTP request. The object type is the return value of _encoder.default(). + :param request_auths: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auths: + for auth_setting in request_auths: + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + return + for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + + def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting): + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) class Endpoint(object): @@ -674,7 +691,8 @@ class Endpoint(object): '_check_input_type', '_check_return_type', '_content_type', - '_spec_property_naming' + '_spec_property_naming', + '_request_auths' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -689,7 +707,8 @@ class Endpoint(object): '_check_input_type': (bool,), '_check_return_type': (bool,), '_spec_property_naming': (bool,), - '_content_type': (none_type, str) + '_content_type': (none_type, str), + '_request_auths': (none_type, list) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -864,4 +883,5 @@ class Endpoint(object): _preload_content=kwargs['_preload_content'], _request_timeout=kwargs['_request_timeout'], _host=_host, + _request_auths=kwargs['_request_auths'], collection_formats=params['collection_format']) diff --git a/samples/client/petstore/python/test/test_fake_api.py b/samples/client/petstore/python/test/test_fake_api.py index d17375a994d..d5ea5856610 100644 --- a/samples/client/petstore/python/test/test_fake_api.py +++ b/samples/client/petstore/python/test/test_fake_api.py @@ -127,6 +127,7 @@ class TestFakeApi(unittest.TestCase): _request_timeout=None, _return_http_data_only=True, _spec_property_naming=False, + _request_auths=None, async_req=False, header_number=1.234, path_integer=34, diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py index 093a4ca6a33..d54ded04e31 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/another_fake_api.py @@ -129,6 +129,10 @@ class AnotherFakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -160,6 +164,7 @@ class AnotherFakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.call_123_test_special_tags_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py index f630549347f..98536575b07 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_api.py @@ -1142,6 +1142,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1173,6 +1177,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.array_model_endpoint.call_with_http_info(**kwargs) def boolean( @@ -1216,6 +1221,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1247,6 +1256,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.boolean_endpoint.call_with_http_info(**kwargs) def create_xml_item( @@ -1292,6 +1302,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1323,6 +1337,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['xml_item'] = \ xml_item return self.create_xml_item_endpoint.call_with_http_info(**kwargs) @@ -1368,6 +1383,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1399,6 +1418,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.number_with_validations_endpoint.call_with_http_info(**kwargs) def object_model_with_ref_props( @@ -1442,6 +1462,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1473,6 +1497,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.object_model_with_ref_props_endpoint.call_with_http_info(**kwargs) def string( @@ -1516,6 +1541,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1547,6 +1576,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.string_endpoint.call_with_http_info(**kwargs) def string_enum( @@ -1590,6 +1620,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1621,6 +1655,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.string_enum_endpoint.call_with_http_info(**kwargs) def test_body_with_file_schema( @@ -1666,6 +1701,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1697,6 +1736,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.test_body_with_file_schema_endpoint.call_with_http_info(**kwargs) @@ -1745,6 +1785,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1776,6 +1820,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['query'] = \ query kwargs['body'] = \ @@ -1825,6 +1870,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1856,6 +1905,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.test_client_model_endpoint.call_with_http_info(**kwargs) @@ -1911,6 +1961,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1942,6 +1996,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['query_integer'] = \ query_integer kwargs['query_string'] = \ @@ -2013,6 +2068,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2044,6 +2103,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['number'] = \ number kwargs['double'] = \ @@ -2102,6 +2162,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2133,6 +2197,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.test_enum_parameters_endpoint.call_with_http_info(**kwargs) def test_group_parameters( @@ -2185,6 +2250,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2216,6 +2285,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['required_string_group'] = \ required_string_group kwargs['required_boolean_group'] = \ @@ -2266,6 +2336,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2297,6 +2371,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['param'] = \ param return self.test_inline_additional_properties_endpoint.call_with_http_info(**kwargs) @@ -2345,6 +2420,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2376,6 +2455,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['param'] = \ param kwargs['param2'] = \ diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags123_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags123_api.py index 70b4a535a81..e6abced8409 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags123_api.py @@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.test_classname_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py index 70b4a535a81..69537296f48 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/fake_classname_tags_123_api.py @@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auth (dict): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auth'] = kwargs.get('_request_auth', None) kwargs['body'] = \ body return self.test_classname_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py index 290bf04cf1e..af164a6ce79 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/pet_api.py @@ -594,6 +594,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -625,6 +629,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.add_pet_endpoint.call_with_http_info(**kwargs) @@ -672,6 +677,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -703,6 +712,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.delete_pet_endpoint.call_with_http_info(**kwargs) @@ -750,6 +760,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -781,6 +795,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['status'] = \ status return self.find_pets_by_status_endpoint.call_with_http_info(**kwargs) @@ -828,6 +843,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -859,6 +878,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['tags'] = \ tags return self.find_pets_by_tags_endpoint.call_with_http_info(**kwargs) @@ -906,6 +926,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -937,6 +961,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.get_pet_by_id_endpoint.call_with_http_info(**kwargs) @@ -983,6 +1008,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1014,6 +1043,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.update_pet_endpoint.call_with_http_info(**kwargs) @@ -1062,6 +1092,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1093,6 +1127,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.update_pet_with_form_endpoint.call_with_http_info(**kwargs) @@ -1142,6 +1177,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1173,6 +1212,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.upload_file_endpoint.call_with_http_info(**kwargs) @@ -1222,6 +1262,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1253,6 +1297,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id kwargs['required_file'] = \ diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py index a1172b1f10e..98e47ccdf86 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/store_api.py @@ -275,6 +275,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -306,6 +310,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['order_id'] = \ order_id return self.delete_order_endpoint.call_with_http_info(**kwargs) @@ -350,6 +355,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -381,6 +390,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.get_inventory_endpoint.call_with_http_info(**kwargs) def get_order_by_id( @@ -426,6 +436,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -457,6 +471,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['order_id'] = \ order_id return self.get_order_by_id_endpoint.call_with_http_info(**kwargs) @@ -503,6 +518,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -534,6 +553,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.place_order_endpoint.call_with_http_info(**kwargs) diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py index 6eabc2a0a01..5f396434292 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api/user_api.py @@ -462,6 +462,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -493,6 +497,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.create_user_endpoint.call_with_http_info(**kwargs) @@ -539,6 +544,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -570,6 +579,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.create_users_with_array_input_endpoint.call_with_http_info(**kwargs) @@ -616,6 +626,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -647,6 +661,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.create_users_with_list_input_endpoint.call_with_http_info(**kwargs) @@ -694,6 +709,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -725,6 +744,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username return self.delete_user_endpoint.call_with_http_info(**kwargs) @@ -771,6 +791,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -802,6 +826,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username return self.get_user_by_name_endpoint.call_with_http_info(**kwargs) @@ -850,6 +875,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -881,6 +910,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username kwargs['password'] = \ @@ -926,6 +956,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -957,6 +991,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.logout_user_endpoint.call_with_http_info(**kwargs) def update_user( @@ -1004,6 +1039,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1035,6 +1074,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username kwargs['body'] = \ diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py index da37b066d3a..e283cf092d7 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/petstore_api/api_client.py @@ -132,7 +132,8 @@ class ApiClient(object): _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None + _content_type: typing.Optional[str] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): config = self.configuration @@ -182,7 +183,8 @@ class ApiClient(object): # auth setting self.update_params_for_auth(header_params, query_params, - auth_settings, resource_path, method, body) + auth_settings, resource_path, method, body, + request_auths=_request_auths) # request url if _host is None: @@ -350,7 +352,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): """Makes the HTTP request (synchronous) and returns deserialized data. @@ -398,6 +401,10 @@ class ApiClient(object): :param _check_type: boolean describing if the data back from the server should have its type checked. :type _check_type: bool, optional + :param _request_auths: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auths: list, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -412,7 +419,7 @@ class ApiClient(object): response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, - _check_type) + _check_type, _request_auths=_request_auths) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -425,7 +432,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host, _check_type)) + _host, _check_type, None, _request_auths)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -597,7 +604,7 @@ class ApiClient(object): return content_types[0] def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body): + resource_path, method, body, request_auths=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -607,24 +614,34 @@ class ApiClient(object): :param method: A string representation of the HTTP request method. :param body: A object representing the body of the HTTP request. The object type is the return value of _encoder.default(). + :param request_auths: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auths: + for auth_setting in request_auths: + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + return + for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + + def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting): + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) class Endpoint(object): @@ -674,7 +691,8 @@ class Endpoint(object): '_check_input_type', '_check_return_type', '_content_type', - '_spec_property_naming' + '_spec_property_naming', + '_request_auths' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -689,7 +707,8 @@ class Endpoint(object): '_check_input_type': (bool,), '_check_return_type': (bool,), '_spec_property_naming': (bool,), - '_content_type': (none_type, str) + '_content_type': (none_type, str), + '_request_auths': (none_type, list) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -864,4 +883,5 @@ class Endpoint(object): _preload_content=kwargs['_preload_content'], _request_timeout=kwargs['_request_timeout'], _host=_host, + _request_auths=kwargs['_request_auths'], collection_formats=params['collection_format']) diff --git a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py index d17375a994d..d5ea5856610 100644 --- a/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py +++ b/samples/client/petstore/python_disallowAdditionalPropertiesIfNotPresent/test/test_fake_api.py @@ -127,6 +127,7 @@ class TestFakeApi(unittest.TestCase): _request_timeout=None, _return_http_data_only=True, _spec_property_naming=False, + _request_auths=None, async_req=False, header_number=1.234, path_integer=34, diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py index 9f3775456e0..7307adb01c0 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api/usage_api.py @@ -253,6 +253,10 @@ class UsageApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -284,6 +288,7 @@ class UsageApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.any_key_endpoint.call_with_http_info(**kwargs) def both_keys( @@ -326,6 +331,10 @@ class UsageApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -357,6 +366,7 @@ class UsageApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.both_keys_endpoint.call_with_http_info(**kwargs) def key_in_header( @@ -399,6 +409,10 @@ class UsageApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -430,6 +444,7 @@ class UsageApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.key_in_header_endpoint.call_with_http_info(**kwargs) def key_in_query( @@ -472,6 +487,10 @@ class UsageApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -503,5 +522,6 @@ class UsageApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.key_in_query_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py index fbbd2aa4f12..eb7268814fa 100644 --- a/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py +++ b/samples/openapi3/client/extensions/x-auth-id-alias/python/x_auth_id_alias/api_client.py @@ -132,7 +132,8 @@ class ApiClient(object): _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None + _content_type: typing.Optional[str] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): config = self.configuration @@ -182,7 +183,8 @@ class ApiClient(object): # auth setting self.update_params_for_auth(header_params, query_params, - auth_settings, resource_path, method, body) + auth_settings, resource_path, method, body, + request_auths=_request_auths) # request url if _host is None: @@ -350,7 +352,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): """Makes the HTTP request (synchronous) and returns deserialized data. @@ -398,6 +401,10 @@ class ApiClient(object): :param _check_type: boolean describing if the data back from the server should have its type checked. :type _check_type: bool, optional + :param _request_auths: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auths: list, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -412,7 +419,7 @@ class ApiClient(object): response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, - _check_type) + _check_type, _request_auths=_request_auths) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -425,7 +432,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host, _check_type)) + _host, _check_type, None, _request_auths)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -597,7 +604,7 @@ class ApiClient(object): return content_types[0] def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body): + resource_path, method, body, request_auths=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -607,24 +614,34 @@ class ApiClient(object): :param method: A string representation of the HTTP request method. :param body: A object representing the body of the HTTP request. The object type is the return value of _encoder.default(). + :param request_auths: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auths: + for auth_setting in request_auths: + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + return + for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + + def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting): + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) class Endpoint(object): @@ -674,7 +691,8 @@ class Endpoint(object): '_check_input_type', '_check_return_type', '_content_type', - '_spec_property_naming' + '_spec_property_naming', + '_request_auths' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -689,7 +707,8 @@ class Endpoint(object): '_check_input_type': (bool,), '_check_return_type': (bool,), '_spec_property_naming': (bool,), - '_content_type': (none_type, str) + '_content_type': (none_type, str), + '_request_auths': (none_type, list) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -864,4 +883,5 @@ class Endpoint(object): _preload_content=kwargs['_preload_content'], _request_timeout=kwargs['_request_timeout'], _host=_host, + _request_auths=kwargs['_request_auths'], collection_formats=params['collection_format']) diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py index f71f533ceec..d634bce7b5a 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api/usage_api.py @@ -208,6 +208,10 @@ class UsageApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -239,6 +243,7 @@ class UsageApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.custom_server_endpoint.call_with_http_info(**kwargs) def default_server( @@ -281,6 +286,10 @@ class UsageApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -312,5 +321,6 @@ class UsageApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.default_server_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py index 3aaf2a296f0..61d33ce421c 100644 --- a/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py +++ b/samples/openapi3/client/features/dynamic-servers/python/dynamic_servers/api_client.py @@ -132,7 +132,8 @@ class ApiClient(object): _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None + _content_type: typing.Optional[str] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): config = self.configuration @@ -182,7 +183,8 @@ class ApiClient(object): # auth setting self.update_params_for_auth(header_params, query_params, - auth_settings, resource_path, method, body) + auth_settings, resource_path, method, body, + request_auths=_request_auths) # request url if _host is None: @@ -350,7 +352,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): """Makes the HTTP request (synchronous) and returns deserialized data. @@ -398,6 +401,10 @@ class ApiClient(object): :param _check_type: boolean describing if the data back from the server should have its type checked. :type _check_type: bool, optional + :param _request_auths: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auths: list, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -412,7 +419,7 @@ class ApiClient(object): response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, - _check_type) + _check_type, _request_auths=_request_auths) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -425,7 +432,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host, _check_type)) + _host, _check_type, None, _request_auths)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -597,7 +604,7 @@ class ApiClient(object): return content_types[0] def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body): + resource_path, method, body, request_auths=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -607,24 +614,34 @@ class ApiClient(object): :param method: A string representation of the HTTP request method. :param body: A object representing the body of the HTTP request. The object type is the return value of _encoder.default(). + :param request_auths: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auths: + for auth_setting in request_auths: + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + return + for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + + def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting): + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) class Endpoint(object): @@ -674,7 +691,8 @@ class Endpoint(object): '_check_input_type', '_check_return_type', '_content_type', - '_spec_property_naming' + '_spec_property_naming', + '_request_auths' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -689,7 +707,8 @@ class Endpoint(object): '_check_input_type': (bool,), '_check_return_type': (bool,), '_spec_property_naming': (bool,), - '_content_type': (none_type, str) + '_content_type': (none_type, str), + '_request_auths': (none_type, list) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -864,4 +883,5 @@ class Endpoint(object): _preload_content=kwargs['_preload_content'], _request_timeout=kwargs['_request_timeout'], _host=_host, + _request_auths=kwargs['_request_auths'], collection_formats=params['collection_format']) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py index 503decf303f..9945fc1ee9b 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/another_fake_api.py @@ -129,6 +129,10 @@ class AnotherFakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -160,6 +164,7 @@ class AnotherFakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['client'] = \ client return self.call_123_test_special_tags_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py index 8ba49f05e76..c3515258b95 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/default_api.py @@ -117,6 +117,10 @@ class DefaultApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -148,5 +152,6 @@ class DefaultApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.foo_get_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py index 4067bbc9464..e36e3b01312 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_api.py @@ -1730,6 +1730,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1761,6 +1765,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.additional_properties_with_array_of_enums_endpoint.call_with_http_info(**kwargs) def array_model( @@ -1804,6 +1809,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1835,6 +1844,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.array_model_endpoint.call_with_http_info(**kwargs) def array_of_enums( @@ -1877,6 +1887,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1908,6 +1922,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.array_of_enums_endpoint.call_with_http_info(**kwargs) def boolean( @@ -1951,6 +1966,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1982,6 +2001,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.boolean_endpoint.call_with_http_info(**kwargs) def composed_one_of_number_with_validations( @@ -2025,6 +2045,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2056,6 +2080,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.composed_one_of_number_with_validations_endpoint.call_with_http_info(**kwargs) def download_attachment( @@ -2100,6 +2125,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2131,6 +2160,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['file_name'] = \ file_name return self.download_attachment_endpoint.call_with_http_info(**kwargs) @@ -2175,6 +2205,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2206,6 +2240,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.enum_test_endpoint.call_with_http_info(**kwargs) def fake_health_get( @@ -2247,6 +2282,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2278,6 +2317,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.fake_health_get_endpoint.call_with_http_info(**kwargs) def mammal( @@ -2323,6 +2363,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2354,6 +2398,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['mammal'] = \ mammal return self.mammal_endpoint.call_with_http_info(**kwargs) @@ -2399,6 +2444,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2430,6 +2479,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.number_with_validations_endpoint.call_with_http_info(**kwargs) def object_model_with_ref_props( @@ -2473,6 +2523,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2504,6 +2558,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.object_model_with_ref_props_endpoint.call_with_http_info(**kwargs) def post_inline_additional_properties_payload( @@ -2546,6 +2601,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2577,6 +2636,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.post_inline_additional_properties_payload_endpoint.call_with_http_info(**kwargs) def post_inline_additional_properties_ref_payload( @@ -2619,6 +2679,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2650,6 +2714,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.post_inline_additional_properties_ref_payload_endpoint.call_with_http_info(**kwargs) def string( @@ -2693,6 +2758,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2724,6 +2793,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.string_endpoint.call_with_http_info(**kwargs) def string_enum( @@ -2767,6 +2837,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2798,6 +2872,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.string_enum_endpoint.call_with_http_info(**kwargs) def test_body_with_file_schema( @@ -2843,6 +2918,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2874,6 +2953,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['file_schema_test_class'] = \ file_schema_test_class return self.test_body_with_file_schema_endpoint.call_with_http_info(**kwargs) @@ -2922,6 +3002,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -2953,6 +3037,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['query'] = \ query kwargs['user'] = \ @@ -3002,6 +3087,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3033,6 +3122,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['client'] = \ client return self.test_client_model_endpoint.call_with_http_info(**kwargs) @@ -3096,6 +3186,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3127,6 +3221,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['number'] = \ number kwargs['double'] = \ @@ -3185,6 +3280,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3216,6 +3315,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.test_enum_parameters_endpoint.call_with_http_info(**kwargs) def test_group_parameters( @@ -3268,6 +3368,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3299,6 +3403,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['required_string_group'] = \ required_string_group kwargs['required_boolean_group'] = \ @@ -3350,6 +3455,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3381,6 +3490,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['request_body'] = \ request_body return self.test_inline_additional_properties_endpoint.call_with_http_info(**kwargs) @@ -3430,6 +3540,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3461,6 +3575,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['param'] = \ param kwargs['param2'] = \ @@ -3518,6 +3633,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3549,6 +3668,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pipe'] = \ pipe kwargs['ioutil'] = \ @@ -3601,6 +3721,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3632,6 +3756,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.tx_rx_any_of_model_endpoint.call_with_http_info(**kwargs) def upload_download_file( @@ -3677,6 +3802,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3708,6 +3837,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['body'] = \ body return self.upload_download_file_endpoint.call_with_http_info(**kwargs) @@ -3756,6 +3886,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3787,6 +3921,7 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['file'] = \ file return self.upload_file_endpoint.call_with_http_info(**kwargs) @@ -3832,6 +3967,10 @@ class FakeApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -3863,5 +4002,6 @@ class FakeApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.upload_files_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py index a6c187b0251..95f69b706e0 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags123_api.py @@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['client'] = \ client return self.test_classname_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py index a6c187b0251..bc79105589d 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/fake_classname_tags_123_api.py @@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auth (dict): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auth'] = kwargs.get('_request_auth', None) kwargs['client'] = \ client return self.test_classname_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py index bb8bebf0383..562acfd4122 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/pet_api.py @@ -483,6 +483,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -514,6 +518,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet'] = \ pet return self.add_pet_endpoint.call_with_http_info(**kwargs) @@ -562,6 +567,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -593,6 +602,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.delete_pet_endpoint.call_with_http_info(**kwargs) @@ -640,6 +650,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -671,6 +685,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['status'] = \ status return self.find_pets_by_status_endpoint.call_with_http_info(**kwargs) @@ -718,6 +733,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -749,6 +768,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['tags'] = \ tags return self.find_pets_by_tags_endpoint.call_with_http_info(**kwargs) @@ -796,6 +816,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -827,6 +851,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.get_pet_by_id_endpoint.call_with_http_info(**kwargs) @@ -874,6 +899,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -905,6 +934,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet'] = \ pet return self.update_pet_endpoint.call_with_http_info(**kwargs) @@ -954,6 +984,10 @@ class PetApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -985,6 +1019,7 @@ class PetApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['pet_id'] = \ pet_id return self.update_pet_with_form_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py index d31348f0859..1e63e3bef30 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/store_api.py @@ -277,6 +277,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -308,6 +312,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['order_id'] = \ order_id return self.delete_order_endpoint.call_with_http_info(**kwargs) @@ -352,6 +357,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -383,6 +392,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.get_inventory_endpoint.call_with_http_info(**kwargs) def get_order_by_id( @@ -428,6 +438,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -459,6 +473,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['order_id'] = \ order_id return self.get_order_by_id_endpoint.call_with_http_info(**kwargs) @@ -506,6 +521,10 @@ class StoreApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -537,6 +556,7 @@ class StoreApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['order'] = \ order return self.place_order_endpoint.call_with_http_info(**kwargs) diff --git a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py index 4f5b6e36627..38c7f659bdd 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api/user_api.py @@ -470,6 +470,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -501,6 +505,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['user'] = \ user return self.create_user_endpoint.call_with_http_info(**kwargs) @@ -548,6 +553,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -579,6 +588,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['user'] = \ user return self.create_users_with_array_input_endpoint.call_with_http_info(**kwargs) @@ -626,6 +636,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -657,6 +671,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['user'] = \ user return self.create_users_with_list_input_endpoint.call_with_http_info(**kwargs) @@ -704,6 +719,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -735,6 +754,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username return self.delete_user_endpoint.call_with_http_info(**kwargs) @@ -782,6 +802,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -813,6 +837,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username return self.get_user_by_name_endpoint.call_with_http_info(**kwargs) @@ -862,6 +887,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -893,6 +922,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username kwargs['password'] = \ @@ -939,6 +969,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -970,6 +1004,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) return self.logout_user_endpoint.call_with_http_info(**kwargs) def update_user( @@ -1017,6 +1052,10 @@ class UserApi(object): _host_index (int/None): specifies the index of the server that we want to use. Default is read from the configuration. + _request_auths (list): set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + Default is None async_req (bool): execute request asynchronously Returns: @@ -1048,6 +1087,7 @@ class UserApi(object): kwargs['_content_type'] = kwargs.get( '_content_type') kwargs['_host_index'] = kwargs.get('_host_index') + kwargs['_request_auths'] = kwargs.get('_request_auths', None) kwargs['username'] = \ username kwargs['user'] = \ diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index c5e0b7ffeb6..eb1abcf5cc3 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -132,7 +132,8 @@ class ApiClient(object): _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, _check_type: typing.Optional[bool] = None, - _content_type: typing.Optional[str] = None + _content_type: typing.Optional[str] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): config = self.configuration @@ -182,7 +183,8 @@ class ApiClient(object): # auth setting self.update_params_for_auth(header_params, query_params, - auth_settings, resource_path, method, body) + auth_settings, resource_path, method, body, + request_auths=_request_auths) # request url if _host is None: @@ -350,7 +352,8 @@ class ApiClient(object): _preload_content: bool = True, _request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None, _host: typing.Optional[str] = None, - _check_type: typing.Optional[bool] = None + _check_type: typing.Optional[bool] = None, + _request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None ): """Makes the HTTP request (synchronous) and returns deserialized data. @@ -398,6 +401,10 @@ class ApiClient(object): :param _check_type: boolean describing if the data back from the server should have its type checked. :type _check_type: bool, optional + :param _request_auths: set to override the auth_settings for an a single + request; this effectively ignores the authentication + in the spec for a single request. + :type _request_auths: list, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -412,7 +419,7 @@ class ApiClient(object): response_type, auth_settings, _return_http_data_only, collection_formats, _preload_content, _request_timeout, _host, - _check_type) + _check_type, _request_auths=_request_auths) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -425,7 +432,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host, _check_type)) + _host, _check_type, None, _request_auths)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -597,7 +604,7 @@ class ApiClient(object): return content_types[0] def update_params_for_auth(self, headers, queries, auth_settings, - resource_path, method, body): + resource_path, method, body, request_auths=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. @@ -607,31 +614,41 @@ class ApiClient(object): :param method: A string representation of the HTTP request method. :param body: A object representing the body of the HTTP request. The object type is the return value of _encoder.default(). + :param request_auths: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auths: + for auth_setting in request_auths: + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + return + for auth in auth_settings: auth_setting = self.configuration.auth_settings().get(auth) if auth_setting: - if auth_setting['in'] == 'cookie': - headers['Cookie'] = auth_setting['value'] - elif auth_setting['in'] == 'header': - if auth_setting['type'] != 'http-signature': - headers[auth_setting['key']] = auth_setting['value'] - else: - # The HTTP signature scheme requires multiple HTTP headers - # that are calculated dynamically. - signing_info = self.configuration.signing_info - auth_headers = signing_info.get_http_signature_headers( - resource_path, method, headers, body, queries) - headers.update(auth_headers) - elif auth_setting['in'] == 'query': - queries.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting) + + def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting): + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + else: + # The HTTP signature scheme requires multiple HTTP headers + # that are calculated dynamically. + signing_info = self.configuration.signing_info + auth_headers = signing_info.get_http_signature_headers( + resource_path, method, headers, body, queries) + headers.update(auth_headers) + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) class Endpoint(object): @@ -681,7 +698,8 @@ class Endpoint(object): '_check_input_type', '_check_return_type', '_content_type', - '_spec_property_naming' + '_spec_property_naming', + '_request_auths' ]) self.params_map['nullable'].extend(['_request_timeout']) self.validations = root_map['validations'] @@ -696,7 +714,8 @@ class Endpoint(object): '_check_input_type': (bool,), '_check_return_type': (bool,), '_spec_property_naming': (bool,), - '_content_type': (none_type, str) + '_content_type': (none_type, str), + '_request_auths': (none_type, list) } self.openapi_types.update(extra_types) self.attribute_map = root_map['attribute_map'] @@ -871,4 +890,5 @@ class Endpoint(object): _preload_content=kwargs['_preload_content'], _request_timeout=kwargs['_request_timeout'], _host=_host, + _request_auths=kwargs['_request_auths'], collection_formats=params['collection_format'])