diff --git a/modules/swagger-codegen/src/main/resources/python/configuration.mustache b/modules/swagger-codegen/src/main/resources/python/configuration.mustache index f2a52cb6e84..62633cdc4a1 100644 --- a/modules/swagger-codegen/src/main/resources/python/configuration.mustache +++ b/modules/swagger-codegen/src/main/resources/python/configuration.mustache @@ -19,7 +19,13 @@ Copyright 2015 SmartBear Software from __future__ import absolute_import import base64 import urllib3 -import httplib + +try: + import httplib +except ImportError: + # python3 + import http.client as httplib + import sys import logging diff --git a/modules/swagger-codegen/src/main/resources/python/rest.mustache b/modules/swagger-codegen/src/main/resources/python/rest.mustache index f6161a6d60c..8a8e55eb3d1 100644 --- a/modules/swagger-codegen/src/main/resources/python/rest.mustache +++ b/modules/swagger-codegen/src/main/resources/python/rest.mustache @@ -216,10 +216,10 @@ class ApiException(Exception): error_message = "({0})\n"\ "Reason: {1}\n".format(self.status, self.reason) 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: - error_message += "HTTP response body: {0}".format(self.body) + error_message += "HTTP response body: {0}\n".format(self.body) return error_message diff --git a/samples/client/petstore/python/swagger_client/api_client.py b/samples/client/petstore/python/swagger_client/api_client.py index 24b1e52ff3e..ca9a3c05104 100644 --- a/samples/client/petstore/python/swagger_client/api_client.py +++ b/samples/client/petstore/python/swagger_client/api_client.py @@ -247,12 +247,12 @@ class ApiClient(object): return None if type(klass) == str: - if 'list[' in klass: + if klass.startswith('list['): sub_kls = re.match('list\[(.*)\]', klass).group(1) return [self.__deserialize(sub_data, sub_kls) for sub_data in data] - if 'dict(' in klass: + if klass.startswith('dict('): sub_kls = re.match('dict\(([^,]*), (.*)\)', klass).group(2) return {k: self.__deserialize(v, sub_kls) for k, v in iteritems(data)} diff --git a/samples/client/petstore/python/swagger_client/configuration.py b/samples/client/petstore/python/swagger_client/configuration.py index a175303a222..8f469b72653 100644 --- a/samples/client/petstore/python/swagger_client/configuration.py +++ b/samples/client/petstore/python/swagger_client/configuration.py @@ -19,7 +19,13 @@ Copyright 2015 SmartBear Software from __future__ import absolute_import import base64 import urllib3 -import httplib + +try: + import httplib +except ImportError: + # python3 + import http.client as httplib + import sys import logging diff --git a/samples/client/petstore/python/swagger_client/models/order.py b/samples/client/petstore/python/swagger_client/models/order.py index dd414e34f32..a381853b91f 100644 --- a/samples/client/petstore/python/swagger_client/models/order.py +++ b/samples/client/petstore/python/swagger_client/models/order.py @@ -56,7 +56,7 @@ class Order(object): self._pet_id = None self._quantity = None self._ship_date = None - self._status = None # Order Status + self._status = None self._complete = None @property diff --git a/samples/client/petstore/python/swagger_client/models/pet.py b/samples/client/petstore/python/swagger_client/models/pet.py index 1a8916bb6b7..57dc93387a9 100644 --- a/samples/client/petstore/python/swagger_client/models/pet.py +++ b/samples/client/petstore/python/swagger_client/models/pet.py @@ -57,7 +57,7 @@ class Pet(object): self._name = None self._photo_urls = None self._tags = None - self._status = None # pet status in the store + self._status = None @property def id(self): diff --git a/samples/client/petstore/python/swagger_client/models/user.py b/samples/client/petstore/python/swagger_client/models/user.py index ecb92eb9dde..7380bc94582 100644 --- a/samples/client/petstore/python/swagger_client/models/user.py +++ b/samples/client/petstore/python/swagger_client/models/user.py @@ -63,7 +63,7 @@ class User(object): self._email = None self._password = None self._phone = None - self._user_status = None # User Status + self._user_status = None @property def id(self): diff --git a/samples/client/petstore/python/swagger_client/rest.py b/samples/client/petstore/python/swagger_client/rest.py index f6161a6d60c..8a8e55eb3d1 100644 --- a/samples/client/petstore/python/swagger_client/rest.py +++ b/samples/client/petstore/python/swagger_client/rest.py @@ -216,10 +216,10 @@ class ApiException(Exception): error_message = "({0})\n"\ "Reason: {1}\n".format(self.status, self.reason) 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: - error_message += "HTTP response body: {0}".format(self.body) + error_message += "HTTP response body: {0}\n".format(self.body) return error_message