diff --git a/modules/openapi-generator/src/main/resources/python/api.mustache b/modules/openapi-generator/src/main/resources/python/api.mustache index 18ced57845ee..1dcbb8607863 100644 --- a/modules/openapi-generator/src/main/resources/python/api.mustache +++ b/modules/openapi-generator/src/main/resources/python/api.mustache @@ -103,6 +103,10 @@ class {{classname}}(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -137,7 +141,8 @@ class {{classname}}(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -266,6 +271,7 @@ class {{classname}}(object): {{#servers.0}} _host=local_var_host, {{/servers.0}} - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) {{/operation}} {{/operations}} 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 66d3577f3c25..7eb04b6943df 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -132,7 +132,8 @@ class ApiClient(object): query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): config = self.configuration @@ -173,7 +174,9 @@ class ApiClient(object): post_params.extend(self.files_parameters(files)) # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) + self.update_params_for_auth( + header_params, query_params, auth_settings, + request_auth=_request_auth) # body if body: @@ -347,7 +350,8 @@ class ApiClient(object): body=None, post_params=None, files=None, response_type=None, auth_settings=None, async_req=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -377,6 +381,10 @@ class ApiClient(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_token: dict, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -390,7 +398,8 @@ class ApiClient(object): body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) + _preload_content, _request_timeout, _host, + _request_auth) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -403,7 +412,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host)) + _host, _request_auth)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -550,29 +559,45 @@ class ApiClient(object): else: return content_types[0] - def update_params_for_auth(self, headers, querys, auth_settings): + def update_params_for_auth(self, headers, querys, auth_settings, + request_auth=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auth: + self._apply_auth_params(headers, querys, request_auth) + 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': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, querys, auth_setting) + + def _apply_auth_params(self, headers, querys, auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) def __deserialize_file(self, response): """Deserializes body to file diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py index 4d69b287ca8b..562b9faa58f2 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/another_fake_api.py @@ -91,6 +91,10 @@ class AnotherFakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class AnotherFakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class AnotherFakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py index 7789acf51c3d..b171fe8b3d7d 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/fake_api.py @@ -91,6 +91,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -159,7 +164,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_boolean_serialize(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -216,6 +222,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -232,7 +242,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -280,7 +291,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_composite_serialize(self, **kwargs): # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -337,6 +349,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -353,7 +369,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -401,7 +418,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_number_serialize(self, **kwargs): # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -458,6 +476,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -474,7 +496,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -522,7 +545,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_string_serialize(self, **kwargs): # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -579,6 +603,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -595,7 +623,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -643,7 +672,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_file_schema(self, body, **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -700,6 +730,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -716,7 +750,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -768,7 +803,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_query_params(self, query, body, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -827,6 +863,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -844,7 +884,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -902,7 +943,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_client_model(self, body, **kwargs): # noqa: E501 """To test \"client\" model # noqa: E501 @@ -959,6 +1001,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -975,7 +1021,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1031,7 +1078,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -1140,6 +1188,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1169,7 +1221,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1287,7 +1340,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_enum_parameters(self, **kwargs): # noqa: E501 """To test enum parameters # noqa: E501 @@ -1372,6 +1426,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1395,7 +1453,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1460,7 +1519,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_group_parameters(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -1537,6 +1597,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1558,7 +1622,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1624,7 +1689,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_inline_additional_properties(self, param, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -1679,6 +1745,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1695,7 +1765,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1747,7 +1818,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_json_form_data(self, param, param2, **kwargs): # noqa: E501 """test json serialization of form data # noqa: E501 @@ -1806,6 +1878,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1823,7 +1899,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1881,7 +1958,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_query_parameter_collection_format(self, pipe, ioutil, http, url, context, **kwargs): # noqa: E501 """test_query_parameter_collection_format # noqa: E501 @@ -1954,6 +2032,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1974,7 +2056,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -2051,4 +2134,5 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py index d963591a49a8..5cd445261491 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/fake_classname_tags_123_api.py @@ -91,6 +91,10 @@ class FakeClassnameTags123Api(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class FakeClassnameTags123Api(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class FakeClassnameTags123Api(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py index 7002fe32740f..3119e2d60c45 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/pet_api.py @@ -89,6 +89,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -105,7 +109,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -157,7 +162,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_pet(self, pet_id, **kwargs): # noqa: E501 """Deletes a pet # noqa: E501 @@ -216,6 +222,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -233,7 +243,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -283,7 +294,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_status(self, status, **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 @@ -340,6 +352,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -356,7 +372,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -409,7 +426,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_tags(self, tags, **kwargs): # noqa: E501 """Finds Pets by tags # noqa: E501 @@ -466,6 +484,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -482,7 +504,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -535,7 +558,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_pet_by_id(self, pet_id, **kwargs): # noqa: E501 """Find pet by ID # noqa: E501 @@ -592,6 +616,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -608,7 +636,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -660,7 +689,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet(self, body, **kwargs): # noqa: E501 """Update an existing pet # noqa: E501 @@ -715,6 +745,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -731,7 +765,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -783,7 +818,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet_with_form(self, pet_id, **kwargs): # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -846,6 +882,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -864,7 +904,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -920,7 +961,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file(self, pet_id, **kwargs): # noqa: E501 """uploads an image # noqa: E501 @@ -983,6 +1025,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1001,7 +1047,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1061,7 +1108,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file_with_required_file(self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 @@ -1124,6 +1172,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1142,7 +1194,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1206,4 +1259,5 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py index 0ede23f05ba2..d2d4c3233341 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/store_api.py @@ -91,6 +91,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -155,7 +160,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_inventory(self, **kwargs): # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -208,6 +214,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -223,7 +233,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -269,7 +280,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_order_by_id(self, order_id, **kwargs): # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -326,6 +338,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -342,7 +358,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -398,7 +415,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def place_order(self, body, **kwargs): # noqa: E501 """Place an order for a pet # noqa: E501 @@ -453,6 +471,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -469,7 +491,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -521,4 +544,5 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py b/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py index a912483b023b..9504f2834a6b 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api/user_api.py @@ -91,6 +91,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -155,7 +160,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_array_input(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -210,6 +216,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -226,7 +236,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -274,7 +285,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_list_input(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -329,6 +341,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -345,7 +361,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -393,7 +410,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_user(self, username, **kwargs): # noqa: E501 """Delete user # noqa: E501 @@ -450,6 +468,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -466,7 +488,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -514,7 +537,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_user_by_name(self, username, **kwargs): # noqa: E501 """Get user by user name # noqa: E501 @@ -569,6 +593,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -585,7 +613,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -637,7 +666,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def login_user(self, username, password, **kwargs): # noqa: E501 """Logs user into the system # noqa: E501 @@ -696,6 +726,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -713,7 +747,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -771,7 +806,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def logout_user(self, **kwargs): # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -822,6 +858,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -837,7 +877,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -879,7 +920,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_user(self, username, body, **kwargs): # noqa: E501 """Updated user # noqa: E501 @@ -940,6 +982,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -957,7 +1003,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1011,4 +1058,5 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-asyncio/petstore_api/api_client.py b/samples/client/petstore/python-asyncio/petstore_api/api_client.py index 7e0d28cd4c68..cc78cbda5421 100644 --- a/samples/client/petstore/python-asyncio/petstore_api/api_client.py +++ b/samples/client/petstore/python-asyncio/petstore_api/api_client.py @@ -123,7 +123,8 @@ class ApiClient(object): query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): config = self.configuration @@ -164,7 +165,9 @@ class ApiClient(object): post_params.extend(self.files_parameters(files)) # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) + self.update_params_for_auth( + header_params, query_params, auth_settings, + request_auth=_request_auth) # body if body: @@ -324,7 +327,8 @@ class ApiClient(object): body=None, post_params=None, files=None, response_type=None, auth_settings=None, async_req=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -354,6 +358,10 @@ class ApiClient(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_token: dict, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -367,7 +375,8 @@ class ApiClient(object): body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) + _preload_content, _request_timeout, _host, + _request_auth) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -380,7 +389,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host)) + _host, _request_auth)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -527,29 +536,45 @@ class ApiClient(object): else: return content_types[0] - def update_params_for_auth(self, headers, querys, auth_settings): + def update_params_for_auth(self, headers, querys, auth_settings, + request_auth=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auth: + self._apply_auth_params(headers, querys, request_auth) + 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': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, querys, auth_setting) + + def _apply_auth_params(self, headers, querys, auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) def __deserialize_file(self, response): """Deserializes body to file diff --git a/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py b/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py index 4d69b287ca8b..562b9faa58f2 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/another_fake_api.py @@ -91,6 +91,10 @@ class AnotherFakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class AnotherFakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class AnotherFakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py b/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py index 7789acf51c3d..b171fe8b3d7d 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/fake_api.py @@ -91,6 +91,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -159,7 +164,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_boolean_serialize(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -216,6 +222,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -232,7 +242,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -280,7 +291,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_composite_serialize(self, **kwargs): # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -337,6 +349,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -353,7 +369,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -401,7 +418,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_number_serialize(self, **kwargs): # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -458,6 +476,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -474,7 +496,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -522,7 +545,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_string_serialize(self, **kwargs): # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -579,6 +603,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -595,7 +623,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -643,7 +672,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_file_schema(self, body, **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -700,6 +730,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -716,7 +750,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -768,7 +803,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_query_params(self, query, body, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -827,6 +863,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -844,7 +884,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -902,7 +943,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_client_model(self, body, **kwargs): # noqa: E501 """To test \"client\" model # noqa: E501 @@ -959,6 +1001,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -975,7 +1021,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1031,7 +1078,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -1140,6 +1188,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1169,7 +1221,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1287,7 +1340,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_enum_parameters(self, **kwargs): # noqa: E501 """To test enum parameters # noqa: E501 @@ -1372,6 +1426,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1395,7 +1453,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1460,7 +1519,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_group_parameters(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -1537,6 +1597,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1558,7 +1622,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1624,7 +1689,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_inline_additional_properties(self, param, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -1679,6 +1745,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1695,7 +1765,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1747,7 +1818,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_json_form_data(self, param, param2, **kwargs): # noqa: E501 """test json serialization of form data # noqa: E501 @@ -1806,6 +1878,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1823,7 +1899,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1881,7 +1958,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_query_parameter_collection_format(self, pipe, ioutil, http, url, context, **kwargs): # noqa: E501 """test_query_parameter_collection_format # noqa: E501 @@ -1954,6 +2032,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1974,7 +2056,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -2051,4 +2134,5 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py b/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py index d963591a49a8..5cd445261491 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/fake_classname_tags_123_api.py @@ -91,6 +91,10 @@ class FakeClassnameTags123Api(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class FakeClassnameTags123Api(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class FakeClassnameTags123Api(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py b/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py index 7002fe32740f..3119e2d60c45 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/pet_api.py @@ -89,6 +89,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -105,7 +109,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -157,7 +162,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_pet(self, pet_id, **kwargs): # noqa: E501 """Deletes a pet # noqa: E501 @@ -216,6 +222,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -233,7 +243,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -283,7 +294,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_status(self, status, **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 @@ -340,6 +352,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -356,7 +372,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -409,7 +426,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_tags(self, tags, **kwargs): # noqa: E501 """Finds Pets by tags # noqa: E501 @@ -466,6 +484,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -482,7 +504,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -535,7 +558,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_pet_by_id(self, pet_id, **kwargs): # noqa: E501 """Find pet by ID # noqa: E501 @@ -592,6 +616,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -608,7 +636,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -660,7 +689,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet(self, body, **kwargs): # noqa: E501 """Update an existing pet # noqa: E501 @@ -715,6 +745,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -731,7 +765,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -783,7 +818,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet_with_form(self, pet_id, **kwargs): # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -846,6 +882,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -864,7 +904,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -920,7 +961,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file(self, pet_id, **kwargs): # noqa: E501 """uploads an image # noqa: E501 @@ -983,6 +1025,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1001,7 +1047,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1061,7 +1108,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file_with_required_file(self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 @@ -1124,6 +1172,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1142,7 +1194,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1206,4 +1259,5 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-tornado/petstore_api/api/store_api.py b/samples/client/petstore/python-tornado/petstore_api/api/store_api.py index 0ede23f05ba2..d2d4c3233341 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/store_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/store_api.py @@ -91,6 +91,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -155,7 +160,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_inventory(self, **kwargs): # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -208,6 +214,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -223,7 +233,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -269,7 +280,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_order_by_id(self, order_id, **kwargs): # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -326,6 +338,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -342,7 +358,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -398,7 +415,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def place_order(self, body, **kwargs): # noqa: E501 """Place an order for a pet # noqa: E501 @@ -453,6 +471,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -469,7 +491,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -521,4 +544,5 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-tornado/petstore_api/api/user_api.py b/samples/client/petstore/python-tornado/petstore_api/api/user_api.py index a912483b023b..9504f2834a6b 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api/user_api.py +++ b/samples/client/petstore/python-tornado/petstore_api/api/user_api.py @@ -91,6 +91,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -155,7 +160,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_array_input(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -210,6 +216,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -226,7 +236,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -274,7 +285,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_list_input(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -329,6 +341,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -345,7 +361,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -393,7 +410,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_user(self, username, **kwargs): # noqa: E501 """Delete user # noqa: E501 @@ -450,6 +468,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -466,7 +488,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -514,7 +537,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_user_by_name(self, username, **kwargs): # noqa: E501 """Get user by user name # noqa: E501 @@ -569,6 +593,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -585,7 +613,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -637,7 +666,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def login_user(self, username, password, **kwargs): # noqa: E501 """Logs user into the system # noqa: E501 @@ -696,6 +726,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -713,7 +747,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -771,7 +806,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def logout_user(self, **kwargs): # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -822,6 +858,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -837,7 +877,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -879,7 +920,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_user(self, username, body, **kwargs): # noqa: E501 """Updated user # noqa: E501 @@ -940,6 +982,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -957,7 +1003,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1011,4 +1058,5 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python-tornado/petstore_api/api_client.py b/samples/client/petstore/python-tornado/petstore_api/api_client.py index 3fc10d72ab50..7782745e5096 100644 --- a/samples/client/petstore/python-tornado/petstore_api/api_client.py +++ b/samples/client/petstore/python-tornado/petstore_api/api_client.py @@ -124,7 +124,8 @@ class ApiClient(object): query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): config = self.configuration @@ -165,7 +166,9 @@ class ApiClient(object): post_params.extend(self.files_parameters(files)) # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) + self.update_params_for_auth( + header_params, query_params, auth_settings, + request_auth=_request_auth) # body if body: @@ -325,7 +328,8 @@ class ApiClient(object): body=None, post_params=None, files=None, response_type=None, auth_settings=None, async_req=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -355,6 +359,10 @@ class ApiClient(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_token: dict, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -368,7 +376,8 @@ class ApiClient(object): body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) + _preload_content, _request_timeout, _host, + _request_auth) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -381,7 +390,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host)) + _host, _request_auth)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -528,29 +537,45 @@ class ApiClient(object): else: return content_types[0] - def update_params_for_auth(self, headers, querys, auth_settings): + def update_params_for_auth(self, headers, querys, auth_settings, + request_auth=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auth: + self._apply_auth_params(headers, querys, request_auth) + 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': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, querys, auth_setting) + + def _apply_auth_params(self, headers, querys, auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) def __deserialize_file(self, response): """Deserializes body to file 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 4d69b287ca8b..562b9faa58f2 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 @@ -91,6 +91,10 @@ class AnotherFakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class AnotherFakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class AnotherFakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 7789acf51c3d..b171fe8b3d7d 100644 --- a/samples/client/petstore/python/petstore_api/api/fake_api.py +++ b/samples/client/petstore/python/petstore_api/api/fake_api.py @@ -91,6 +91,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -159,7 +164,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_boolean_serialize(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -216,6 +222,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -232,7 +242,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -280,7 +291,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_composite_serialize(self, **kwargs): # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -337,6 +349,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -353,7 +369,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -401,7 +418,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_number_serialize(self, **kwargs): # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -458,6 +476,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -474,7 +496,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -522,7 +545,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_string_serialize(self, **kwargs): # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -579,6 +603,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -595,7 +623,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -643,7 +672,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_file_schema(self, body, **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -700,6 +730,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -716,7 +750,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -768,7 +803,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_query_params(self, query, body, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -827,6 +863,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -844,7 +884,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -902,7 +943,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_client_model(self, body, **kwargs): # noqa: E501 """To test \"client\" model # noqa: E501 @@ -959,6 +1001,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -975,7 +1021,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1031,7 +1078,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -1140,6 +1188,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1169,7 +1221,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1287,7 +1340,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_enum_parameters(self, **kwargs): # noqa: E501 """To test enum parameters # noqa: E501 @@ -1372,6 +1426,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1395,7 +1453,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1460,7 +1519,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_group_parameters(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -1537,6 +1597,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1558,7 +1622,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1624,7 +1689,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_inline_additional_properties(self, param, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -1679,6 +1745,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1695,7 +1765,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1747,7 +1818,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_json_form_data(self, param, param2, **kwargs): # noqa: E501 """test json serialization of form data # noqa: E501 @@ -1806,6 +1878,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1823,7 +1899,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1881,7 +1958,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_query_parameter_collection_format(self, pipe, ioutil, http, url, context, **kwargs): # noqa: E501 """test_query_parameter_collection_format # noqa: E501 @@ -1954,6 +2032,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1974,7 +2056,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -2051,4 +2134,5 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 d963591a49a8..5cd445261491 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 @@ -91,6 +91,10 @@ class FakeClassnameTags123Api(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class FakeClassnameTags123Api(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class FakeClassnameTags123Api(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 7002fe32740f..3119e2d60c45 100644 --- a/samples/client/petstore/python/petstore_api/api/pet_api.py +++ b/samples/client/petstore/python/petstore_api/api/pet_api.py @@ -89,6 +89,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -105,7 +109,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -157,7 +162,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_pet(self, pet_id, **kwargs): # noqa: E501 """Deletes a pet # noqa: E501 @@ -216,6 +222,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -233,7 +243,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -283,7 +294,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_status(self, status, **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 @@ -340,6 +352,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -356,7 +372,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -409,7 +426,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_tags(self, tags, **kwargs): # noqa: E501 """Finds Pets by tags # noqa: E501 @@ -466,6 +484,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -482,7 +504,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -535,7 +558,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_pet_by_id(self, pet_id, **kwargs): # noqa: E501 """Find pet by ID # noqa: E501 @@ -592,6 +616,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -608,7 +636,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -660,7 +689,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet(self, body, **kwargs): # noqa: E501 """Update an existing pet # noqa: E501 @@ -715,6 +745,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -731,7 +765,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -783,7 +818,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet_with_form(self, pet_id, **kwargs): # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -846,6 +882,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -864,7 +904,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -920,7 +961,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file(self, pet_id, **kwargs): # noqa: E501 """uploads an image # noqa: E501 @@ -983,6 +1025,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1001,7 +1047,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1061,7 +1108,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file_with_required_file(self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 @@ -1124,6 +1172,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1142,7 +1194,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1206,4 +1259,5 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 0ede23f05ba2..d2d4c3233341 100644 --- a/samples/client/petstore/python/petstore_api/api/store_api.py +++ b/samples/client/petstore/python/petstore_api/api/store_api.py @@ -91,6 +91,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -155,7 +160,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_inventory(self, **kwargs): # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -208,6 +214,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -223,7 +233,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -269,7 +280,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_order_by_id(self, order_id, **kwargs): # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -326,6 +338,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -342,7 +358,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -398,7 +415,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def place_order(self, body, **kwargs): # noqa: E501 """Place an order for a pet # noqa: E501 @@ -453,6 +471,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -469,7 +491,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -521,4 +544,5 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 a912483b023b..9504f2834a6b 100644 --- a/samples/client/petstore/python/petstore_api/api/user_api.py +++ b/samples/client/petstore/python/petstore_api/api/user_api.py @@ -91,6 +91,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -155,7 +160,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_array_input(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -210,6 +216,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -226,7 +236,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -274,7 +285,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_list_input(self, body, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -329,6 +341,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -345,7 +361,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -393,7 +410,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_user(self, username, **kwargs): # noqa: E501 """Delete user # noqa: E501 @@ -450,6 +468,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -466,7 +488,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -514,7 +537,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_user_by_name(self, username, **kwargs): # noqa: E501 """Get user by user name # noqa: E501 @@ -569,6 +593,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -585,7 +613,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -637,7 +666,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def login_user(self, username, password, **kwargs): # noqa: E501 """Logs user into the system # noqa: E501 @@ -696,6 +726,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -713,7 +747,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -771,7 +806,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def logout_user(self, **kwargs): # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -822,6 +858,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -837,7 +877,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -879,7 +920,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_user(self, username, body, **kwargs): # noqa: E501 """Updated user # noqa: E501 @@ -940,6 +982,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -957,7 +1003,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1011,4 +1058,5 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) diff --git a/samples/client/petstore/python/petstore_api/api_client.py b/samples/client/petstore/python/petstore_api/api_client.py index 7b1b0010a49a..80dbae6b7b8f 100644 --- a/samples/client/petstore/python/petstore_api/api_client.py +++ b/samples/client/petstore/python/petstore_api/api_client.py @@ -122,7 +122,8 @@ class ApiClient(object): query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): config = self.configuration @@ -163,7 +164,9 @@ class ApiClient(object): post_params.extend(self.files_parameters(files)) # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) + self.update_params_for_auth( + header_params, query_params, auth_settings, + request_auth=_request_auth) # body if body: @@ -323,7 +326,8 @@ class ApiClient(object): body=None, post_params=None, files=None, response_type=None, auth_settings=None, async_req=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -353,6 +357,10 @@ class ApiClient(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_token: dict, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -366,7 +374,8 @@ class ApiClient(object): body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) + _preload_content, _request_timeout, _host, + _request_auth) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -379,7 +388,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host)) + _host, _request_auth)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -526,29 +535,45 @@ class ApiClient(object): else: return content_types[0] - def update_params_for_auth(self, headers, querys, auth_settings): + def update_params_for_auth(self, headers, querys, auth_settings, + request_auth=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auth: + self._apply_auth_params(headers, querys, request_auth) + 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': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, querys, auth_setting) + + def _apply_auth_params(self, headers, querys, auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) def __deserialize_file(self, response): """Deserializes body to file diff --git a/samples/client/petstore/python/tests/test_pet_api.py b/samples/client/petstore/python/tests/test_pet_api.py index 500505735efa..a7b47bdc5670 100644 --- a/samples/client/petstore/python/tests/test_pet_api.py +++ b/samples/client/petstore/python/tests/test_pet_api.py @@ -121,6 +121,30 @@ class PetApiTests(unittest.TestCase): self.pet_api.add_pet(self.pet, _request_timeout=5) self.pet_api.add_pet(self.pet, _request_timeout=(1, 2)) + def test_auth_settings(self): + mock_pool = MockPoolManager(self) + self.api_client.rest_client.pool_manager = mock_pool + + mock_pool.expect_request('POST', HOST + '/pet', + body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)), + headers={'Content-Type': 'application/json', + 'Authorization': 'Bearer ACCESS_TOKEN', + 'User-Agent': 'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=None) + mock_pool.expect_request('POST', HOST + '/pet', + body=json.dumps(self.api_client.sanitize_for_serialization(self.pet)), + headers={'Content-Type': 'application/json', + 'Authorization': 'Prefix ANOTHER_TOKEN', + 'User-Agent': 'OpenAPI-Generator/1.0.0/python'}, + preload_content=True, timeout=None) + + self.pet_api.add_pet(self.pet, _request_auth=None) + self.pet_api.add_pet(self.pet, _request_auth={ + 'in': 'header', + 'key': 'Authorization', + 'value': 'Prefix ANOTHER_TOKEN' + }) + def test_separate_default_client_instances(self): pet_api = petstore_api.PetApi() pet_api2 = petstore_api.PetApi() 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 9421b337d4bf..ffb18035db5e 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 @@ -91,6 +91,10 @@ class AnotherFakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class AnotherFakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class AnotherFakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 a14b43c994ce..73fa98052752 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 @@ -85,6 +85,10 @@ class DefaultApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -100,7 +104,8 @@ class DefaultApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -146,4 +151,5 @@ class DefaultApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 6fe97f5b5cee..b484f561d5f3 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 @@ -85,6 +85,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -100,7 +104,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -146,7 +151,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_http_signature_test(self, pet, **kwargs): # noqa: E501 """test http signature authentication # noqa: E501 @@ -209,6 +215,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -227,7 +237,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -283,7 +294,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_boolean_serialize(self, **kwargs): # noqa: E501 """fake_outer_boolean_serialize # noqa: E501 @@ -340,6 +352,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -356,7 +372,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -408,7 +425,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_composite_serialize(self, **kwargs): # noqa: E501 """fake_outer_composite_serialize # noqa: E501 @@ -465,6 +483,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -481,7 +503,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -533,7 +556,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_number_serialize(self, **kwargs): # noqa: E501 """fake_outer_number_serialize # noqa: E501 @@ -590,6 +614,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -606,7 +634,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -658,7 +687,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def fake_outer_string_serialize(self, **kwargs): # noqa: E501 """fake_outer_string_serialize # noqa: E501 @@ -715,6 +745,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -731,7 +765,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -783,7 +818,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_file_schema(self, file_schema_test_class, **kwargs): # noqa: E501 """test_body_with_file_schema # noqa: E501 @@ -840,6 +876,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -856,7 +896,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -908,7 +949,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_body_with_query_params(self, query, user, **kwargs): # noqa: E501 """test_body_with_query_params # noqa: E501 @@ -967,6 +1009,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -984,7 +1030,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1042,7 +1089,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_client_model(self, client, **kwargs): # noqa: E501 """To test \"client\" model # noqa: E501 @@ -1099,6 +1147,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1115,7 +1167,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1171,7 +1224,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_endpoint_parameters(self, number, double, pattern_without_delimiter, byte, **kwargs): # noqa: E501 """Fake endpoint for testing various parameters 假端點 偽のエンドポイント 가짜 엔드 포인트 # noqa: E501 @@ -1280,6 +1334,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1309,7 +1367,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1427,7 +1486,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_enum_parameters(self, **kwargs): # noqa: E501 """To test enum parameters # noqa: E501 @@ -1512,6 +1572,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1535,7 +1599,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1600,7 +1665,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_group_parameters(self, required_string_group, required_boolean_group, required_int64_group, **kwargs): # noqa: E501 """Fake endpoint to test group parameters (optional) # noqa: E501 @@ -1677,6 +1743,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1698,7 +1768,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1764,7 +1835,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_inline_additional_properties(self, request_body, **kwargs): # noqa: E501 """test inline additionalProperties # noqa: E501 @@ -1819,6 +1891,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1835,7 +1911,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1887,7 +1964,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_json_form_data(self, param, param2, **kwargs): # noqa: E501 """test json serialization of form data # noqa: E501 @@ -1946,6 +2024,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1963,7 +2045,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -2021,7 +2104,8 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def test_query_parameter_collection_format(self, pipe, ioutil, http, url, context, **kwargs): # noqa: E501 """test_query_parameter_collection_format # noqa: E501 @@ -2094,6 +2178,10 @@ class FakeApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -2114,7 +2202,8 @@ class FakeApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -2191,4 +2280,5 @@ class FakeApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 19d22cd10d65..9295236c5691 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 @@ -91,6 +91,10 @@ class FakeClassnameTags123Api(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class FakeClassnameTags123Api(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -163,4 +168,5 @@ class FakeClassnameTags123Api(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 8c8f5d936719..468267e78729 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 @@ -89,6 +89,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -118,7 +122,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -171,7 +176,8 @@ class PetApi(object): _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), _host=local_var_host, - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_pet(self, pet_id, **kwargs): # noqa: E501 """Deletes a pet # noqa: E501 @@ -230,6 +236,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -247,7 +257,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -297,7 +308,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_status(self, status, **kwargs): # noqa: E501 """Finds Pets by status # noqa: E501 @@ -354,6 +366,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -370,7 +386,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -423,7 +440,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def find_pets_by_tags(self, tags, **kwargs): # noqa: E501 """Finds Pets by tags # noqa: E501 @@ -480,6 +498,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -496,7 +518,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -549,7 +572,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_pet_by_id(self, pet_id, **kwargs): # noqa: E501 """Find pet by ID # noqa: E501 @@ -606,6 +630,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -622,7 +650,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -674,7 +703,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet(self, pet, **kwargs): # noqa: E501 """Update an existing pet # noqa: E501 @@ -729,6 +759,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -758,7 +792,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -811,7 +846,8 @@ class PetApi(object): _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), _host=local_var_host, - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_pet_with_form(self, pet_id, **kwargs): # noqa: E501 """Updates a pet in the store with form data # noqa: E501 @@ -874,6 +910,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -892,7 +932,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -948,7 +989,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file(self, pet_id, **kwargs): # noqa: E501 """uploads an image # noqa: E501 @@ -1011,6 +1053,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1029,7 +1075,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1089,7 +1136,8 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def upload_file_with_required_file(self, pet_id, required_file, **kwargs): # noqa: E501 """uploads an image (required) # noqa: E501 @@ -1152,6 +1200,10 @@ class PetApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -1170,7 +1222,8 @@ class PetApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1234,4 +1287,5 @@ class PetApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 2b35556ba815..ea01f1b53ffb 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 @@ -91,6 +91,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -155,7 +160,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_inventory(self, **kwargs): # noqa: E501 """Returns pet inventories by status # noqa: E501 @@ -208,6 +214,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -223,7 +233,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -269,7 +280,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_order_by_id(self, order_id, **kwargs): # noqa: E501 """Find purchase order by ID # noqa: E501 @@ -326,6 +338,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -342,7 +358,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -398,7 +415,8 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def place_order(self, order, **kwargs): # noqa: E501 """Place an order for a pet # noqa: E501 @@ -453,6 +471,10 @@ class StoreApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -469,7 +491,8 @@ class StoreApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -525,4 +548,5 @@ class StoreApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 38d0b4ee5b9f..d0c057dba195 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 @@ -91,6 +91,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -107,7 +111,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -159,7 +164,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_array_input(self, user, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -214,6 +220,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -230,7 +240,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -282,7 +293,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def create_users_with_list_input(self, user, **kwargs): # noqa: E501 """Creates list of users with given input array # noqa: E501 @@ -337,6 +349,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -353,7 +369,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -405,7 +422,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def delete_user(self, username, **kwargs): # noqa: E501 """Delete user # noqa: E501 @@ -462,6 +480,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -478,7 +500,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -526,7 +549,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def get_user_by_name(self, username, **kwargs): # noqa: E501 """Get user by user name # noqa: E501 @@ -581,6 +605,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -597,7 +625,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -649,7 +678,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def login_user(self, username, password, **kwargs): # noqa: E501 """Logs user into the system # noqa: E501 @@ -708,6 +738,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -725,7 +759,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -783,7 +818,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def logout_user(self, **kwargs): # noqa: E501 """Logs out current logged in user session # noqa: E501 @@ -834,6 +870,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -849,7 +889,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -891,7 +932,8 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) def update_user(self, username, user, **kwargs): # noqa: E501 """Updated user # noqa: E501 @@ -952,6 +994,10 @@ class UserApi(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_auth: dict, optional :return: Returns the result object. If the method is called asynchronously, returns the request thread. @@ -969,7 +1015,8 @@ class UserApi(object): 'async_req', '_return_http_data_only', '_preload_content', - '_request_timeout' + '_request_timeout', + '_request_auth' ] ) @@ -1027,4 +1074,5 @@ class UserApi(object): _return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501 _preload_content=local_var_params.get('_preload_content', True), _request_timeout=local_var_params.get('_request_timeout'), - collection_formats=collection_formats) + collection_formats=collection_formats, + _request_auth=local_var_params.get('_request_auth')) 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 7b1b0010a49a..80dbae6b7b8f 100644 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -122,7 +122,8 @@ class ApiClient(object): query_params=None, header_params=None, body=None, post_params=None, files=None, response_type=None, auth_settings=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): config = self.configuration @@ -163,7 +164,9 @@ class ApiClient(object): post_params.extend(self.files_parameters(files)) # auth setting - self.update_params_for_auth(header_params, query_params, auth_settings) + self.update_params_for_auth( + header_params, query_params, auth_settings, + request_auth=_request_auth) # body if body: @@ -323,7 +326,8 @@ class ApiClient(object): body=None, post_params=None, files=None, response_type=None, auth_settings=None, async_req=None, _return_http_data_only=None, collection_formats=None, - _preload_content=True, _request_timeout=None, _host=None): + _preload_content=True, _request_timeout=None, _host=None, + _request_auth=None): """Makes the HTTP request (synchronous) and returns deserialized data. To make an async_req request, set the async_req parameter. @@ -353,6 +357,10 @@ class ApiClient(object): number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts. + :param _request_auth: 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_token: dict, optional :return: If async_req parameter is True, the request will be called asynchronously. @@ -366,7 +374,8 @@ class ApiClient(object): body, post_params, files, response_type, auth_settings, _return_http_data_only, collection_formats, - _preload_content, _request_timeout, _host) + _preload_content, _request_timeout, _host, + _request_auth) return self.pool.apply_async(self.__call_api, (resource_path, method, path_params, @@ -379,7 +388,7 @@ class ApiClient(object): collection_formats, _preload_content, _request_timeout, - _host)) + _host, _request_auth)) def request(self, method, url, query_params=None, headers=None, post_params=None, body=None, _preload_content=True, @@ -526,29 +535,45 @@ class ApiClient(object): else: return content_types[0] - def update_params_for_auth(self, headers, querys, auth_settings): + def update_params_for_auth(self, headers, querys, auth_settings, + request_auth=None): """Updates header and query params based on authentication setting. :param headers: Header parameters dict to be updated. :param querys: Query parameters tuple list to be updated. :param auth_settings: Authentication setting identifiers list. + :param request_auth: if set, the provided settings will + override the token in the configuration. """ if not auth_settings: return + if request_auth: + self._apply_auth_params(headers, querys, request_auth) + 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': - headers[auth_setting['key']] = auth_setting['value'] - elif auth_setting['in'] == 'query': - querys.append((auth_setting['key'], auth_setting['value'])) - else: - raise ApiValueError( - 'Authentication token must be in `query` or `header`' - ) + self._apply_auth_params(headers, querys, auth_setting) + + def _apply_auth_params(self, headers, querys, auth_setting): + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param querys: Query parameters tuple list to be updated. + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + querys.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) def __deserialize_file(self, response): """Deserializes body to file