in Python, a method as the default value of a formal parameter defines the value when the module is loaded (normally at import time), not when the method is invoked

This commit is contained in:
Bob Pasker 2015-12-31 18:10:19 -05:00
parent cafea6f726
commit dfae08adc8

View File

@ -66,8 +66,7 @@ class ApiClient(object):
:param header_name: a header 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,
header_name=None, header_value=None, cookie=None):
def __init__(self, host=None, header_name=None, header_value=None, cookie=None):
"""
Constructor of the class.
@ -76,7 +75,10 @@ class ApiClient(object):
self.default_headers = {}
if header_name is not None:
self.default_headers[header_name] = header_value
self.host = host
if host is None:
self.host = Configuration().host
else:
self.host = host
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Python-Swagger/{{packageVersion}}'