Merge pull request #1602 from wing328/python_auth_update

[Python] update python authentication to skip empty token/username, password
This commit is contained in:
wing328 2015-11-23 01:41:02 +08:00
commit df6acdd3cf
7 changed files with 68 additions and 30 deletions

View File

@ -453,7 +453,9 @@ class ApiClient(object):
for auth in auth_settings: for auth in auth_settings:
auth_setting = config.auth_settings().get(auth) auth_setting = config.auth_settings().get(auth)
if auth_setting: if auth_setting:
if auth_setting['in'] == 'header': if not auth_setting['value']:
continue
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value'] headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query': elif auth_setting['in'] == 'query':
querys[auth_setting['key']] = auth_setting['value'] querys[auth_setting['key']] = auth_setting['value']

File diff suppressed because one or more lines are too long

View File

@ -20,3 +20,17 @@ Requirement already satisfied (use --upgrade to upgrade): randomize in ./.venv/l
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2)) Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./.venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): nose in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in ./venv/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Requirement already satisfied (use --upgrade to upgrade): virtualenv>=1.11.2 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): py>=1.4.17 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): pluggy<0.4.0,>=0.3.0 in ./venv/lib/python2.7/site-packages (from tox->-r dev-requirements.txt (line 2))

View File

@ -453,7 +453,9 @@ class ApiClient(object):
for auth in auth_settings: for auth in auth_settings:
auth_setting = config.auth_settings().get(auth) auth_setting = config.auth_settings().get(auth)
if auth_setting: if auth_setting:
if auth_setting['in'] == 'header': if not auth_setting['value']:
continue
elif auth_setting['in'] == 'header':
headers[auth_setting['key']] = auth_setting['value'] headers[auth_setting['key']] = auth_setting['value']
elif auth_setting['in'] == 'query': elif auth_setting['in'] == 'query':
querys[auth_setting['key']] = auth_setting['value'] querys[auth_setting['key']] = auth_setting['value']

View File

@ -79,6 +79,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/pet'.replace('{format}', 'json') resource_path = '/pet'.replace('{format}', 'json')
method = 'PUT' method = 'PUT'
@ -154,6 +155,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/pet'.replace('{format}', 'json') resource_path = '/pet'.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -229,6 +231,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/pet/findByStatus'.replace('{format}', 'json') resource_path = '/pet/findByStatus'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -304,6 +307,7 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/pet/findByTags'.replace('{format}', 'json') resource_path = '/pet/findByTags'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -365,9 +369,6 @@ class PetApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'pet_id' is set
if pet_id is None:
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`")
all_params = ['pet_id'] all_params = ['pet_id']
all_params.append('callback') all_params.append('callback')
@ -382,6 +383,10 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `get_pet_by_id`")
resource_path = '/pet/{petId}'.replace('{format}', 'json') resource_path = '/pet/{petId}'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -445,9 +450,6 @@ class PetApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'pet_id' is set
if pet_id is None:
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`")
all_params = ['pet_id', 'name', 'status'] all_params = ['pet_id', 'name', 'status']
all_params.append('callback') all_params.append('callback')
@ -462,6 +464,10 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `update_pet_with_form`")
resource_path = '/pet/{petId}'.replace('{format}', 'json') resource_path = '/pet/{petId}'.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -528,9 +534,6 @@ class PetApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'pet_id' is set
if pet_id is None:
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`")
all_params = ['pet_id', 'api_key'] all_params = ['pet_id', 'api_key']
all_params.append('callback') all_params.append('callback')
@ -545,6 +548,10 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `delete_pet`")
resource_path = '/pet/{petId}'.replace('{format}', 'json') resource_path = '/pet/{petId}'.replace('{format}', 'json')
method = 'DELETE' method = 'DELETE'
@ -610,9 +617,6 @@ class PetApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'pet_id' is set
if pet_id is None:
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`")
all_params = ['pet_id', 'additional_metadata', 'file'] all_params = ['pet_id', 'additional_metadata', 'file']
all_params.append('callback') all_params.append('callback')
@ -627,6 +631,10 @@ class PetApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'pet_id' is set
if ('pet_id' not in params) or (params['pet_id'] is None):
raise ValueError("Missing the required parameter `pet_id` when calling `upload_file`")
resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json') resource_path = '/pet/{petId}/uploadImage'.replace('{format}', 'json')
method = 'POST' method = 'POST'

View File

@ -78,6 +78,7 @@ class StoreApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/store/inventory'.replace('{format}', 'json') resource_path = '/store/inventory'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -151,6 +152,7 @@ class StoreApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/store/order'.replace('{format}', 'json') resource_path = '/store/order'.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -212,9 +214,6 @@ class StoreApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'order_id' is set
if order_id is None:
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`")
all_params = ['order_id'] all_params = ['order_id']
all_params.append('callback') all_params.append('callback')
@ -229,6 +228,10 @@ class StoreApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'order_id' is set
if ('order_id' not in params) or (params['order_id'] is None):
raise ValueError("Missing the required parameter `order_id` when calling `get_order_by_id`")
resource_path = '/store/order/{orderId}'.replace('{format}', 'json') resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -290,9 +293,6 @@ class StoreApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'order_id' is set
if order_id is None:
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`")
all_params = ['order_id'] all_params = ['order_id']
all_params.append('callback') all_params.append('callback')
@ -307,6 +307,10 @@ class StoreApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'order_id' is set
if ('order_id' not in params) or (params['order_id'] is None):
raise ValueError("Missing the required parameter `order_id` when calling `delete_order`")
resource_path = '/store/order/{orderId}'.replace('{format}', 'json') resource_path = '/store/order/{orderId}'.replace('{format}', 'json')
method = 'DELETE' method = 'DELETE'

View File

@ -79,6 +79,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/user'.replace('{format}', 'json') resource_path = '/user'.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -154,6 +155,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/user/createWithArray'.replace('{format}', 'json') resource_path = '/user/createWithArray'.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -229,6 +231,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/user/createWithList'.replace('{format}', 'json') resource_path = '/user/createWithList'.replace('{format}', 'json')
method = 'POST' method = 'POST'
@ -305,6 +308,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/user/login'.replace('{format}', 'json') resource_path = '/user/login'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -381,6 +385,7 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
resource_path = '/user/logout'.replace('{format}', 'json') resource_path = '/user/logout'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -440,9 +445,6 @@ class UserApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'username' is set
if username is None:
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`")
all_params = ['username'] all_params = ['username']
all_params.append('callback') all_params.append('callback')
@ -457,6 +459,10 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'username' is set
if ('username' not in params) or (params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `get_user_by_name`")
resource_path = '/user/{username}'.replace('{format}', 'json') resource_path = '/user/{username}'.replace('{format}', 'json')
method = 'GET' method = 'GET'
@ -519,9 +525,6 @@ class UserApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'username' is set
if username is None:
raise ValueError("Missing the required parameter `username` when calling `update_user`")
all_params = ['username', 'body'] all_params = ['username', 'body']
all_params.append('callback') all_params.append('callback')
@ -536,6 +539,10 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'username' is set
if ('username' not in params) or (params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `update_user`")
resource_path = '/user/{username}'.replace('{format}', 'json') resource_path = '/user/{username}'.replace('{format}', 'json')
method = 'PUT' method = 'PUT'
@ -599,9 +606,6 @@ class UserApi(object):
If the method is called asynchronously, If the method is called asynchronously,
returns the request thread. returns the request thread.
""" """
# verify the required parameter 'username' is set
if username is None:
raise ValueError("Missing the required parameter `username` when calling `delete_user`")
all_params = ['username'] all_params = ['username']
all_params.append('callback') all_params.append('callback')
@ -616,6 +620,10 @@ class UserApi(object):
params[key] = val params[key] = val
del params['kwargs'] del params['kwargs']
# verify the required parameter 'username' is set
if ('username' not in params) or (params['username'] is None):
raise ValueError("Missing the required parameter `username` when calling `delete_user`")
resource_path = '/user/{username}'.replace('{format}', 'json') resource_path = '/user/{username}'.replace('{format}', 'json')
method = 'DELETE' method = 'DELETE'