rebuild python client

This commit is contained in:
geekerzp 2015-05-27 20:50:04 +08:00
parent eac884d85b
commit 654a73c5a8
10 changed files with 17 additions and 62 deletions

View File

@ -62,11 +62,12 @@ class ApiClient(object):
body=None, post_params=None, files=None, response=None, auth_settings=None):
# headers parameters
headers_params = self.default_headers.copy().update(header_params)
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
headers_params['Cookie'] = self.cookie
if headers_params:
headers_params = ApiClient.sanitize_for_serialization(headers_params)
header_params['Cookie'] = self.cookie
if header_params:
header_params = ApiClient.sanitize_for_serialization(header_params)
# path parameters
if path_params:
@ -86,7 +87,7 @@ class ApiClient(object):
post_params = self.sanitize_for_serialization(post_params)
# auth setting
self.update_params_for_auth(headers_params, query_params, auth_settings)
self.update_params_for_auth(header_params, query_params, auth_settings)
# body
if body:
@ -96,7 +97,7 @@ class ApiClient(object):
url = self.host + resource_path
# perform request and return response
response_data = self.request(method, url, query_params=query_params, headers=headers_params,
response_data = self.request(method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body)
# deserialize response data
@ -301,3 +302,4 @@ class ApiClient(object):
raise ValueError('Authentication token must be in `query` or `header`')

View File

@ -1,12 +0,0 @@
Metadata-Version: 1.0
Name: SwaggerPetstore
Version: 1.0.0
Summary: Swagger Petstore
Home-page: UNKNOWN
Author: UNKNOWN
Author-email: apiteam@wordnik.com
License: UNKNOWN
Description: This is a sample server Petstore server. You can find out more about Swagger at <a href=\"http://swagger.io\">http://swagger.io</a> or on irc.freenode.net, #swagger. For this sample, you can use the api key \"special-key\" to test the authorization filters
Keywords: Swagger,Swagger Petstore
Platform: UNKNOWN

View File

@ -1,25 +0,0 @@
setup.cfg
setup.py
SwaggerPetstore/__init__.py
SwaggerPetstore/config.py
SwaggerPetstore/rest.py
SwaggerPetstore/swagger.py
SwaggerPetstore/util.py
SwaggerPetstore.egg-info/PKG-INFO
SwaggerPetstore.egg-info/SOURCES.txt
SwaggerPetstore.egg-info/dependency_links.txt
SwaggerPetstore.egg-info/requires.txt
SwaggerPetstore.egg-info/top_level.txt
SwaggerPetstore/apis/__init__.py
SwaggerPetstore/apis/pet_api.py
SwaggerPetstore/apis/store_api.py
SwaggerPetstore/apis/user_api.py
SwaggerPetstore/models/__init__.py
SwaggerPetstore/models/category.py
SwaggerPetstore/models/order.py
SwaggerPetstore/models/pet.py
SwaggerPetstore/models/tag.py
SwaggerPetstore/models/user.py
tests/__init__.py
tests/test_api_client.py
tests/test_pet_api.py

View File

@ -15,8 +15,7 @@ def get_basic_auth_token():
global username
global password
if username and password:
return urllib3.util.make_headers(basic_auth=username + ':' + password).get('authorization')
return urllib3.util.make_headers(basic_auth=username + ':' + password).get('authorization')
def auth_settings():
return {

View File

@ -62,12 +62,12 @@ class ApiClient(object):
body=None, post_params=None, files=None, response=None, auth_settings=None):
# headers parameters
headers = self.default_headers.copy()
headers.update(header_params)
header_params = header_params or {}
header_params.update(self.default_headers)
if self.cookie:
headers['Cookie'] = self.cookie
if headers:
headers = self.sanitize_for_serialization(headers)
header_params['Cookie'] = self.cookie
if header_params:
header_params = ApiClient.sanitize_for_serialization(header_params)
# path parameters
if path_params:
@ -87,7 +87,7 @@ class ApiClient(object):
post_params = self.sanitize_for_serialization(post_params)
# auth setting
self.update_params_for_auth(headers, query_params, auth_settings)
self.update_params_for_auth(header_params, query_params, auth_settings)
# body
if body:
@ -97,7 +97,7 @@ class ApiClient(object):
url = self.host + resource_path
# perform request and return response
response_data = self.request(method, url, query_params=query_params, headers=headers,
response_data = self.request(method, url, query_params=query_params, headers=header_params,
post_params=post_params, body=body)
# deserialize response data
@ -302,3 +302,4 @@ class ApiClient(object):
raise ValueError('Authentication token must be in `query` or `header`')

View File

@ -1,5 +0,0 @@
Requirement already satisfied (use --upgrade to upgrade): nose in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 1))
Requirement already satisfied (use --upgrade to upgrade): tox in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 2))
Requirement already satisfied (use --upgrade to upgrade): coverage in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 3))
Requirement already satisfied (use --upgrade to upgrade): randomize in /Users/geekerzp/.virtualenvs/python2/lib/python2.7/site-packages (from -r dev-requirements.txt (line 4))
Cleaning up...