forked from loafle/openapi-generator-original
[Python] avoid unnecessary dictionary lookup in get_api_key method (#3592)
This commit is contained in:
committed by
William Cheng
parent
f5327b601e
commit
850c493c63
@@ -227,11 +227,13 @@ class Configuration(six.with_metaclass(TypeWithDefault, object)):
|
||||
:param identifier: The identifier of apiKey.
|
||||
:return: The token for api key authentication.
|
||||
"""
|
||||
if (self.api_key.get(identifier) and
|
||||
self.api_key_prefix.get(identifier)):
|
||||
return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501
|
||||
elif self.api_key.get(identifier):
|
||||
return self.api_key[identifier]
|
||||
key = self.api_key.get(identifier)
|
||||
if key:
|
||||
prefix = self.api_key_prefix.get(identifier)
|
||||
if prefix:
|
||||
return "%s %s" % (prefix, key)
|
||||
else:
|
||||
return key
|
||||
|
||||
def get_basic_auth_token(self):
|
||||
"""Gets HTTP basic authentication header (string).
|
||||
|
||||
Reference in New Issue
Block a user