updated config.py of python client.

This commit is contained in:
geekerzp
2015-05-27 18:37:34 +08:00
parent b09250ed33
commit d7aaaea0df
4 changed files with 12 additions and 8 deletions

View File

@@ -1,20 +1,22 @@
import base64
import urllib3
def get_api_key_with_prefix(key):
global api_key
global api_key_prefix
if api_key_prefix[key]:
if api_key.get(key) and api_key_prefix.get(key):
return api_key_prefix[key] + ' ' + api_key[key]
else:
elif api_key.get(key):
return api_key[key]
def get_basic_auth_token():
global username
global password
return base64.base64encode('Basic ' + username + password)
if username and password:
return urllib3.util.make_headers(basic_auth=username + ':' + password).get('authorization')
def auth_settings():
return {

View File

@@ -87,7 +87,7 @@ class ApiClient(object):
post_params = self.sanitize_for_serialization(post_params)
# auth setting
self.update_params_for_auth(header_params, query_params, auth_settings)
self.update_params_for_auth(headers, query_params, auth_settings)
# body
if body: