[python-client] Enable per-request auth settings (#6569)

* Enable per-request access token in Python client.

* Add missing regenerated sample files.

* Rework to the more general case of overriding the auth settings for a request.

* Add unit tests.

* Update api_client.mustache so that request_auth overrides all other auth settings when specified.
This commit is contained in:
Warren Gray
2020-06-11 02:40:10 -04:00
committed by GitHub
parent ebcce67419
commit 933ab0640a
32 changed files with 1437 additions and 382 deletions

View File

@@ -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'))

View File

@@ -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'))

View File

@@ -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'))

View File

@@ -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'))

View File

@@ -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'))

View File

@@ -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'))

View File

@@ -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