forked from loafle/openapi-generator-original
Fix issues in python client
This commit is contained in:
parent
84ff5cfc87
commit
1c0eb60c71
@ -19,7 +19,13 @@ Copyright 2015 SmartBear Software
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import base64
|
import base64
|
||||||
import urllib3
|
import urllib3
|
||||||
import httplib
|
|
||||||
|
try:
|
||||||
|
import httplib
|
||||||
|
except ImportError:
|
||||||
|
# python3
|
||||||
|
import http.client as httplib
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -216,10 +216,10 @@ class ApiException(Exception):
|
|||||||
error_message = "({0})\n"\
|
error_message = "({0})\n"\
|
||||||
"Reason: {1}\n".format(self.status, self.reason)
|
"Reason: {1}\n".format(self.status, self.reason)
|
||||||
if self.headers:
|
if self.headers:
|
||||||
error_message += "HTTP response headers: {0}".format(self.headers)
|
error_message += "HTTP response headers: {0}\n".format(self.headers)
|
||||||
|
|
||||||
if self.body:
|
if self.body:
|
||||||
error_message += "HTTP response body: {0}".format(self.body)
|
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||||
|
|
||||||
return error_message
|
return error_message
|
||||||
|
|
||||||
|
@ -247,12 +247,12 @@ class ApiClient(object):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
if type(klass) == str:
|
if type(klass) == str:
|
||||||
if 'list[' in klass:
|
if klass.startswith('list['):
|
||||||
sub_kls = re.match('list\[(.*)\]', klass).group(1)
|
sub_kls = re.match('list\[(.*)\]', klass).group(1)
|
||||||
return [self.__deserialize(sub_data, sub_kls)
|
return [self.__deserialize(sub_data, sub_kls)
|
||||||
for sub_data in data]
|
for sub_data in data]
|
||||||
|
|
||||||
if 'dict(' in klass:
|
if klass.startswith('dict('):
|
||||||
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
|
sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2)
|
||||||
return {k: self.__deserialize(v, sub_kls)
|
return {k: self.__deserialize(v, sub_kls)
|
||||||
for k, v in iteritems(data)}
|
for k, v in iteritems(data)}
|
||||||
|
@ -19,7 +19,13 @@ Copyright 2015 SmartBear Software
|
|||||||
from __future__ import absolute_import
|
from __future__ import absolute_import
|
||||||
import base64
|
import base64
|
||||||
import urllib3
|
import urllib3
|
||||||
import httplib
|
|
||||||
|
try:
|
||||||
|
import httplib
|
||||||
|
except ImportError:
|
||||||
|
# python3
|
||||||
|
import http.client as httplib
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ class Order(object):
|
|||||||
self._pet_id = None
|
self._pet_id = None
|
||||||
self._quantity = None
|
self._quantity = None
|
||||||
self._ship_date = None
|
self._ship_date = None
|
||||||
self._status = None # Order Status
|
self._status = None
|
||||||
self._complete = None
|
self._complete = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
@ -57,7 +57,7 @@ class Pet(object):
|
|||||||
self._name = None
|
self._name = None
|
||||||
self._photo_urls = None
|
self._photo_urls = None
|
||||||
self._tags = None
|
self._tags = None
|
||||||
self._status = None # pet status in the store
|
self._status = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def id(self):
|
def id(self):
|
||||||
|
@ -63,7 +63,7 @@ class User(object):
|
|||||||
self._email = None
|
self._email = None
|
||||||
self._password = None
|
self._password = None
|
||||||
self._phone = None
|
self._phone = None
|
||||||
self._user_status = None # User Status
|
self._user_status = None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def id(self):
|
def id(self):
|
||||||
|
@ -216,10 +216,10 @@ class ApiException(Exception):
|
|||||||
error_message = "({0})\n"\
|
error_message = "({0})\n"\
|
||||||
"Reason: {1}\n".format(self.status, self.reason)
|
"Reason: {1}\n".format(self.status, self.reason)
|
||||||
if self.headers:
|
if self.headers:
|
||||||
error_message += "HTTP response headers: {0}".format(self.headers)
|
error_message += "HTTP response headers: {0}\n".format(self.headers)
|
||||||
|
|
||||||
if self.body:
|
if self.body:
|
||||||
error_message += "HTTP response body: {0}".format(self.body)
|
error_message += "HTTP response body: {0}\n".format(self.body)
|
||||||
|
|
||||||
return error_message
|
return error_message
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user