[python] Fixes Configuration w/ access_token at initialization (#14153)

* Fixes templates

* Samples regenerated

* Adds discard_unknown_keys back in, regenerates samples
This commit is contained in:
Justin Black
2022-11-30 11:09:31 -08:00
committed by GitHub
parent bd79231d6b
commit 28ae689615
6 changed files with 83 additions and 102 deletions

View File

@@ -104,9 +104,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
@@ -218,9 +218,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
@@ -404,9 +404,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
@@ -598,9 +598,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
@@ -912,9 +912,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
@@ -1034,9 +1034,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
@@ -1159,9 +1159,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class
@@ -1293,9 +1293,9 @@ configuration = petstore_api.Configuration(
# Configure OAuth2 access token for authorization: petstore_auth
configuration = petstore_api.Configuration(
host = "http://petstore.swagger.io:80/v2"
host = "http://petstore.swagger.io:80/v2",
access_token = 'YOUR_ACCESS_TOKEN'
)
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# Enter a context with an instance of the API client
with petstore_api.ApiClient(configuration) as api_client:
# Create an instance of the API class

View File

@@ -157,15 +157,22 @@ conf = petstore_api.Configuration(
_default = None
def __init__(self, host=None,
api_key=None, api_key_prefix=None,
username=None, password=None,
discard_unknown_keys=False,
disabled_client_side_validations="",
signing_info=None,
server_index=None, server_variables=None,
server_operation_index=None, server_operation_variables=None,
):
def __init__(
self,
host=None,
api_key=None,
api_key_prefix=None,
username=None,
password=None,
discard_unknown_keys=False,
disabled_client_side_validations="",
signing_info=None,
server_index=None,
server_variables=None,
server_operation_index=None,
server_operation_variables=None,
access_token=None,
):
"""Constructor
"""
self._base_path = "http://petstore.swagger.io:80/v2" if host is None else host