Merge pull request #1010 from onovy/develop_2.0

[Python] Allow to set cookie in python(3) API constructor.
This commit is contained in:
wing328 2015-07-25 17:03:11 +08:00
commit db37c02ebd
2 changed files with 4 additions and 4 deletions

View File

@ -45,13 +45,13 @@ class ApiClient(object):
:param header_value: a header value to pass when making calls to the API :param header_value: a header value to pass when making calls to the API
""" """
def __init__(self, host=Configuration().host, def __init__(self, host=Configuration().host,
header_name=None, header_value=None): header_name=None, header_value=None, cookie=None):
self.default_headers = {} self.default_headers = {}
if header_name is not None: if header_name is not None:
self.default_headers[header_name] = header_value self.default_headers[header_name] = header_value
self.host = host self.host = host
self.cookie = None self.cookie = cookie
# Set default User-Agent. # Set default User-Agent.
self.user_agent = 'Python-Swagger' self.user_agent = 'Python-Swagger'

View File

@ -18,13 +18,13 @@ from .models import *
class ApiClient: class ApiClient:
"""Generic API client for Swagger client library builds""" """Generic API client for Swagger client library builds"""
def __init__(self, apiKey=None, apiServer=None): def __init__(self, apiKey=None, apiServer=None, cookie=None):
if apiKey == None: if apiKey == None:
raise Exception('You must pass an apiKey when instantiating the ' raise Exception('You must pass an apiKey when instantiating the '
'APIClient') 'APIClient')
self.apiKey = apiKey self.apiKey = apiKey
self.apiServer = apiServer self.apiServer = apiServer
self.cookie = None self.cookie = cookie
def callAPI(self, resourcePath, method, queryParams, postData, def callAPI(self, resourcePath, method, queryParams, postData,
headerParams=None): headerParams=None):