Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ class ApiClient(object):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
from dateutil.parser import isoparse
return isoparse(string)
except ImportError:
return string
except ValueError:
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.9-SNAPSHOT
2.4.25-SNAPSHOT
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
self.cookie = cookie
# Set default User-Agent.
self.user_agent = 'Swagger-Codegen/1.0.0/python'
self.client_side_validation = configuration.client_side_validation

def __del__(self):
if self._pool is not None:
Expand Down Expand Up @@ -533,7 +534,7 @@ def __deserialize_file(self, response):
content_disposition).group(1)
path = os.path.join(os.path.dirname(path), filename)

with open(path, "wb") as f:
with open(path, "w") as f:
f.write(response.data)

return path
Expand Down Expand Up @@ -586,8 +587,8 @@ def __deserialize_datatime(self, string):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
from dateutil.parser import isoparse
return isoparse(string)
except ImportError:
return string
except ValueError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ def __init__(self):
self.api_key = {}
# dict to store API prefix (e.g. Bearer)
self.api_key_prefix = {}
# function to refresh API key if expired
self.refresh_api_key_hook = None
# Username for HTTP basic authentication
self.username = ""
# Password for HTTP basic authentication
Expand Down Expand Up @@ -97,6 +99,9 @@ def __init__(self):
# Safe chars for path_param
self.safe_chars_for_path_param = ''

# Disable client side validation
self.client_side_validation = True

@classmethod
def set_default(cls, default):
cls._default = default
Expand Down Expand Up @@ -203,11 +208,17 @@ def get_api_key_with_prefix(self, identifier):
:param identifier: The identifier of apiKey.
:return: The token for api key authentication.
"""
if (self.api_key.get(identifier) and
self.api_key_prefix.get(identifier)):
return self.api_key_prefix[identifier] + ' ' + self.api_key[identifier] # noqa: E501
elif self.api_key.get(identifier):
return self.api_key[identifier]

if self.refresh_api_key_hook:
self.refresh_api_key_hook(self)

key = self.api_key.get(identifier)
if key:
prefix = self.api_key_prefix.get(identifier)
if prefix:
return "%s %s" % (prefix, key)
else:
return key

def get_basic_auth_token(self):
"""Gets HTTP basic authentication header (string).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

import six

from petstore_api.configuration import Configuration


class ModelReturn(object):
"""NOTE: This class is auto generated by the swagger code generator program.
Expand All @@ -38,8 +40,11 @@ class ModelReturn(object):
'_return': 'return'
}

def __init__(self, _return=None): # noqa: E501
def __init__(self, _return=None, _configuration=None): # noqa: E501
"""ModelReturn - a model defined in Swagger""" # noqa: E501
if _configuration is None:
_configuration = Configuration()
self._configuration = _configuration

self.__return = None
self.discriminator = None
Expand Down Expand Up @@ -110,8 +115,11 @@ def __eq__(self, other):
if not isinstance(other, ModelReturn):
return False

return self.__dict__ == other.__dict__
return self.to_dict() == other.to_dict()

def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
if not isinstance(other, ModelReturn):
return True

return self.to_dict() != other.to_dict()
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def request(self, method, url, query_params=None, headers=None,
if query_params:
url += '?' + urlencode(query_params)
if re.search('json', headers['Content-Type'], re.IGNORECASE):
request_body = None
request_body = '{}'
if body is not None:
request_body = json.dumps(body)
r = self.pool_manager.request(
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/python/.swagger-codegen/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.20-SNAPSHOT
2.4.25-SNAPSHOT
4 changes: 2 additions & 2 deletions samples/client/petstore/python/petstore_api/api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -587,8 +587,8 @@ def __deserialize_datatime(self, string):
:return: datetime.
"""
try:
from dateutil.parser import parse
return parse(string)
from dateutil.parser import isoparse
return isoparse(string)
except ImportError:
return string
except ValueError:
Expand Down