From dfae08adc8dd833847498ad5fb4ea4e7e7dd9588 Mon Sep 17 00:00:00 2001 From: Bob Pasker Date: Thu, 31 Dec 2015 18:10:19 -0500 Subject: [PATCH] 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 --- .../src/main/resources/python/api_client.mustache | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/swagger-codegen/src/main/resources/python/api_client.mustache b/modules/swagger-codegen/src/main/resources/python/api_client.mustache index d097ec4536d..f6e34f041e3 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -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}}'