[Python] - Migrate enable per request authentification in new python codegen (#11279)

* LDS-2166 : add request auth to api client and api call

Can now overwrite request auth by request

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : Add samples

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : fix test

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : Fixing test in python_disallowAdditionalPropertiesIfNotPresent

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : add removed line break

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : add name for _request_auth params

Add None when _content_type is not set

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : add tabulation

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : fix missing values

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* LDS-2166 : generate sample

Add _request_auth in sample

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* Request auth can now use multiple auth

Request auth is now a list of dict

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

* Add request_auths in test

Envoyé depuis mon iPhone.
P.S. : Ce commit est certifié sans gluten

Co-authored-by: Géry THRASIBULE <g.thrasibule@lecomptoirdespharmacies.fr>
This commit is contained in:
LeComptoirDesPharmacies
2022-03-20 21:12:59 +01:00
committed by GitHub
parent bc2624d307
commit 87a5182c24
33 changed files with 940 additions and 128 deletions

View File

@@ -129,6 +129,10 @@ class AnotherFakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -160,6 +164,7 @@ class AnotherFakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.call_123_test_special_tags_endpoint.call_with_http_info(**kwargs)

View File

@@ -1142,6 +1142,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1173,6 +1177,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.array_model_endpoint.call_with_http_info(**kwargs)
def boolean(
@@ -1216,6 +1221,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1247,6 +1256,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.boolean_endpoint.call_with_http_info(**kwargs)
def create_xml_item(
@@ -1292,6 +1302,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1323,6 +1337,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['xml_item'] = \
xml_item
return self.create_xml_item_endpoint.call_with_http_info(**kwargs)
@@ -1368,6 +1383,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1399,6 +1418,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.number_with_validations_endpoint.call_with_http_info(**kwargs)
def object_model_with_ref_props(
@@ -1442,6 +1462,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1473,6 +1497,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.object_model_with_ref_props_endpoint.call_with_http_info(**kwargs)
def string(
@@ -1516,6 +1541,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1547,6 +1576,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.string_endpoint.call_with_http_info(**kwargs)
def string_enum(
@@ -1590,6 +1620,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1621,6 +1655,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.string_enum_endpoint.call_with_http_info(**kwargs)
def test_body_with_file_schema(
@@ -1666,6 +1701,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1697,6 +1736,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.test_body_with_file_schema_endpoint.call_with_http_info(**kwargs)
@@ -1745,6 +1785,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1776,6 +1820,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['query'] = \
query
kwargs['body'] = \
@@ -1825,6 +1870,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1856,6 +1905,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.test_client_model_endpoint.call_with_http_info(**kwargs)
@@ -1911,6 +1961,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1942,6 +1996,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['query_integer'] = \
query_integer
kwargs['query_string'] = \
@@ -2013,6 +2068,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -2044,6 +2103,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['number'] = \
number
kwargs['double'] = \
@@ -2102,6 +2162,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -2133,6 +2197,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.test_enum_parameters_endpoint.call_with_http_info(**kwargs)
def test_group_parameters(
@@ -2185,6 +2250,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -2216,6 +2285,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['required_string_group'] = \
required_string_group
kwargs['required_boolean_group'] = \
@@ -2266,6 +2336,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -2297,6 +2371,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['param'] = \
param
return self.test_inline_additional_properties_endpoint.call_with_http_info(**kwargs)
@@ -2345,6 +2420,10 @@ class FakeApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -2376,6 +2455,7 @@ class FakeApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['param'] = \
param
kwargs['param2'] = \

View File

@@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.test_classname_endpoint.call_with_http_info(**kwargs)

View File

@@ -131,6 +131,10 @@ class FakeClassnameTags123Api(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auth (dict): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -162,6 +166,7 @@ class FakeClassnameTags123Api(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auth'] = kwargs.get('_request_auth', None)
kwargs['body'] = \
body
return self.test_classname_endpoint.call_with_http_info(**kwargs)

View File

@@ -594,6 +594,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -625,6 +629,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.add_pet_endpoint.call_with_http_info(**kwargs)
@@ -672,6 +677,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -703,6 +712,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['pet_id'] = \
pet_id
return self.delete_pet_endpoint.call_with_http_info(**kwargs)
@@ -750,6 +760,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -781,6 +795,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['status'] = \
status
return self.find_pets_by_status_endpoint.call_with_http_info(**kwargs)
@@ -828,6 +843,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -859,6 +878,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['tags'] = \
tags
return self.find_pets_by_tags_endpoint.call_with_http_info(**kwargs)
@@ -906,6 +926,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -937,6 +961,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['pet_id'] = \
pet_id
return self.get_pet_by_id_endpoint.call_with_http_info(**kwargs)
@@ -983,6 +1008,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1014,6 +1043,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.update_pet_endpoint.call_with_http_info(**kwargs)
@@ -1062,6 +1092,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1093,6 +1127,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['pet_id'] = \
pet_id
return self.update_pet_with_form_endpoint.call_with_http_info(**kwargs)
@@ -1142,6 +1177,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1173,6 +1212,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['pet_id'] = \
pet_id
return self.upload_file_endpoint.call_with_http_info(**kwargs)
@@ -1222,6 +1262,10 @@ class PetApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1253,6 +1297,7 @@ class PetApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['pet_id'] = \
pet_id
kwargs['required_file'] = \

View File

@@ -275,6 +275,10 @@ class StoreApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -306,6 +310,7 @@ class StoreApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['order_id'] = \
order_id
return self.delete_order_endpoint.call_with_http_info(**kwargs)
@@ -350,6 +355,10 @@ class StoreApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -381,6 +390,7 @@ class StoreApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.get_inventory_endpoint.call_with_http_info(**kwargs)
def get_order_by_id(
@@ -426,6 +436,10 @@ class StoreApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -457,6 +471,7 @@ class StoreApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['order_id'] = \
order_id
return self.get_order_by_id_endpoint.call_with_http_info(**kwargs)
@@ -503,6 +518,10 @@ class StoreApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -534,6 +553,7 @@ class StoreApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.place_order_endpoint.call_with_http_info(**kwargs)

View File

@@ -462,6 +462,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -493,6 +497,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.create_user_endpoint.call_with_http_info(**kwargs)
@@ -539,6 +544,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -570,6 +579,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.create_users_with_array_input_endpoint.call_with_http_info(**kwargs)
@@ -616,6 +626,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -647,6 +661,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['body'] = \
body
return self.create_users_with_list_input_endpoint.call_with_http_info(**kwargs)
@@ -694,6 +709,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -725,6 +744,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['username'] = \
username
return self.delete_user_endpoint.call_with_http_info(**kwargs)
@@ -771,6 +791,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -802,6 +826,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['username'] = \
username
return self.get_user_by_name_endpoint.call_with_http_info(**kwargs)
@@ -850,6 +875,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -881,6 +910,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['username'] = \
username
kwargs['password'] = \
@@ -926,6 +956,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -957,6 +991,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
return self.logout_user_endpoint.call_with_http_info(**kwargs)
def update_user(
@@ -1004,6 +1039,10 @@ class UserApi(object):
_host_index (int/None): specifies the index of the server
that we want to use.
Default is read from the configuration.
_request_auths (list): set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
Default is None
async_req (bool): execute request asynchronously
Returns:
@@ -1035,6 +1074,7 @@ class UserApi(object):
kwargs['_content_type'] = kwargs.get(
'_content_type')
kwargs['_host_index'] = kwargs.get('_host_index')
kwargs['_request_auths'] = kwargs.get('_request_auths', None)
kwargs['username'] = \
username
kwargs['body'] = \

View File

@@ -132,7 +132,8 @@ class ApiClient(object):
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
_host: typing.Optional[str] = None,
_check_type: typing.Optional[bool] = None,
_content_type: typing.Optional[str] = None
_content_type: typing.Optional[str] = None,
_request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None
):
config = self.configuration
@@ -182,7 +183,8 @@ class ApiClient(object):
# auth setting
self.update_params_for_auth(header_params, query_params,
auth_settings, resource_path, method, body)
auth_settings, resource_path, method, body,
request_auths=_request_auths)
# request url
if _host is None:
@@ -350,7 +352,8 @@ class ApiClient(object):
_preload_content: bool = True,
_request_timeout: typing.Optional[typing.Union[int, float, typing.Tuple]] = None,
_host: typing.Optional[str] = None,
_check_type: typing.Optional[bool] = None
_check_type: typing.Optional[bool] = None,
_request_auths: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = None
):
"""Makes the HTTP request (synchronous) and returns deserialized data.
@@ -398,6 +401,10 @@ class ApiClient(object):
:param _check_type: boolean describing if the data back from the server
should have its type checked.
:type _check_type: bool, optional
:param _request_auths: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auths: list, optional
:return:
If async_req parameter is True,
the request will be called asynchronously.
@@ -412,7 +419,7 @@ class ApiClient(object):
response_type, auth_settings,
_return_http_data_only, collection_formats,
_preload_content, _request_timeout, _host,
_check_type)
_check_type, _request_auths=_request_auths)
return self.pool.apply_async(self.__call_api, (resource_path,
method, path_params,
@@ -425,7 +432,7 @@ class ApiClient(object):
collection_formats,
_preload_content,
_request_timeout,
_host, _check_type))
_host, _check_type, None, _request_auths))
def request(self, method, url, query_params=None, headers=None,
post_params=None, body=None, _preload_content=True,
@@ -597,7 +604,7 @@ class ApiClient(object):
return content_types[0]
def update_params_for_auth(self, headers, queries, auth_settings,
resource_path, method, body):
resource_path, method, body, request_auths=None):
"""Updates header and query params based on authentication setting.
:param headers: Header parameters dict to be updated.
@@ -607,24 +614,34 @@ class ApiClient(object):
:param method: A string representation of the HTTP request method.
:param body: A object representing the body of the HTTP request.
The object type is the return value of _encoder.default().
:param request_auths: if set, the provided settings will
override the token in the configuration.
"""
if not auth_settings:
return
if request_auths:
for auth_setting in request_auths:
self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting)
return
for auth in auth_settings:
auth_setting = self.configuration.auth_settings().get(auth)
if auth_setting:
if auth_setting['in'] == 'cookie':
headers['Cookie'] = auth_setting['value']
elif auth_setting['in'] == 'header':
if auth_setting['type'] != 'http-signature':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
queries.append((auth_setting['key'], auth_setting['value']))
else:
raise ApiValueError(
'Authentication token must be in `query` or `header`'
)
self._apply_auth_params(headers, queries, resource_path, method, body, auth_setting)
def _apply_auth_params(self, headers, queries, resource_path, method, body, auth_setting):
if auth_setting['in'] == 'cookie':
headers['Cookie'] = auth_setting['value']
elif auth_setting['in'] == 'header':
if auth_setting['type'] != 'http-signature':
headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query':
queries.append((auth_setting['key'], auth_setting['value']))
else:
raise ApiValueError(
'Authentication token must be in `query` or `header`'
)
class Endpoint(object):
@@ -674,7 +691,8 @@ class Endpoint(object):
'_check_input_type',
'_check_return_type',
'_content_type',
'_spec_property_naming'
'_spec_property_naming',
'_request_auths'
])
self.params_map['nullable'].extend(['_request_timeout'])
self.validations = root_map['validations']
@@ -689,7 +707,8 @@ class Endpoint(object):
'_check_input_type': (bool,),
'_check_return_type': (bool,),
'_spec_property_naming': (bool,),
'_content_type': (none_type, str)
'_content_type': (none_type, str),
'_request_auths': (none_type, list)
}
self.openapi_types.update(extra_types)
self.attribute_map = root_map['attribute_map']
@@ -864,4 +883,5 @@ class Endpoint(object):
_preload_content=kwargs['_preload_content'],
_request_timeout=kwargs['_request_timeout'],
_host=_host,
_request_auths=kwargs['_request_auths'],
collection_formats=params['collection_format'])

View File

@@ -127,6 +127,7 @@ class TestFakeApi(unittest.TestCase):
_request_timeout=None,
_return_http_data_only=True,
_spec_property_naming=False,
_request_auths=None,
async_req=False,
header_number=1.234,
path_integer=34,