forked from loafle/openapi-generator-original
add oauth support in python
This commit is contained in:
@@ -72,6 +72,11 @@ class Configuration(object):
|
||||
# Password for HTTP basic authentication
|
||||
self.password = ""
|
||||
|
||||
{{#authMethods}}{{#isOAuth}}
|
||||
# token for OAuth
|
||||
self.auth_token = ""
|
||||
{{/isOAuth}}{{/authMethods}}
|
||||
|
||||
# Logging Settings
|
||||
self.logger = {}
|
||||
self.logger["package_logger"] = logging.getLogger("{{packageName}}")
|
||||
@@ -231,8 +236,15 @@ class Configuration(object):
|
||||
'key': 'Authorization',
|
||||
'value': self.get_basic_auth_token()
|
||||
},
|
||||
{{/isBasic}}
|
||||
{{/authMethods}}
|
||||
{{/isBasic}}{{#isOauth}}
|
||||
'{{name}}':
|
||||
{
|
||||
'type': 'oauth2',
|
||||
'in': 'header',
|
||||
'key': 'Authorization',
|
||||
'value': 'Bearer ' + self.auth_token
|
||||
},
|
||||
{{/isOauth}}{{/authMethods}}
|
||||
}
|
||||
|
||||
def to_debug_report(self):
|
||||
|
||||
@@ -409,7 +409,7 @@ class PetApi(object):
|
||||
select_header_content_type([])
|
||||
|
||||
# Authentication setting
|
||||
auth_settings = ['api_key', 'petstore_auth']
|
||||
auth_settings = ['api_key']
|
||||
|
||||
response = self.api_client.call_api(resource_path, method,
|
||||
path_params,
|
||||
|
||||
@@ -220,6 +220,7 @@ class Configuration(object):
|
||||
'key': 'api_key',
|
||||
'value': self.get_api_key_with_prefix('api_key')
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
def to_debug_report(self):
|
||||
|
||||
Reference in New Issue
Block a user