diff --git a/modules/swagger-codegen/src/main/resources/python/configuration.mustache b/modules/swagger-codegen/src/main/resources/python/configuration.mustache index b732224b21e..f2a52cb6e84 100644 --- a/modules/swagger-codegen/src/main/resources/python/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/python/configuration.mustache @@ -119,17 +119,17 @@ class Configuration(object): # setting log level to default `logging.WARNING` self.logger.setLevel(logging.WARNING) - def get_api_key_with_prefix(self, key): + def get_api_key_with_prefix(self, identifier): """ Gets API key (with prefix if set). - :param key: Name of apiKey. + :param identifier: The identifier of apiKey. :return: The token for api key authentication. """ - if self.api_key.get(key) and self.api_key_prefix.get(key): - return self.api_key_prefix[key] + ' ' + self.api_key[key] - elif self.api_key.get(key): - return self.api_key[key] + if self.api_key.get(identifier) and self.api_key_prefix.get(identifier): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] + elif self.api_key.get(identifier): + return self.api_key[identifier] def get_basic_auth_token(self): """ diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/swagger_client/api_client.py index a183bb4cda3..934cfda1c1a 100644 --- a/samples/client/petstore/python/swagger_client/api_client.py +++ b/samples/client/petstore/python/swagger_client/api_client.py @@ -64,7 +64,8 @@ class ApiClient(object): :param header_value: a header value to pass when making calls to the API. """ def __init__(self, host=Configuration().host, - header_name=None, header_value=None): + header_name=None, header_value=None, cookie=None): + """ Constructor of the class. """ @@ -72,7 +73,7 @@ class ApiClient(object): if header_name is not None: self.default_headers[header_name] = header_value self.host = host - self.cookie = None + self.cookie = cookie # Set default User-Agent. self.user_agent = 'Python-Swagger' diff --git a/samples/client/petstore/python/swagger_client/configuration.py b/samples/client/petstore/python/swagger_client/configuration.py index cfe4100e9bd..a175303a222 100644 --- a/samples/client/petstore/python/swagger_client/configuration.py +++ b/samples/client/petstore/python/swagger_client/configuration.py @@ -119,17 +119,17 @@ class Configuration(object): # setting log level to default `logging.WARNING` self.logger.setLevel(logging.WARNING) - def get_api_key_with_prefix(self, key): + def get_api_key_with_prefix(self, identifier): """ Gets API key (with prefix if set). - :param key: Name of apiKey. + :param identifier: The identifier of apiKey. :return: The token for api key authentication. """ - if self.api_key.get(key) and self.api_key_prefix.get(key): - return self.api_key_prefix[key] + ' ' + self.api_key[key] - elif self.api_key.get(key): - return self.api_key[key] + if self.api_key.get(identifier) and self.api_key_prefix.get(identifier): + return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] + elif self.api_key.get(identifier): + return self.api_key[identifier] def get_basic_auth_token(self): """