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 8b948b5f4e8..4b10f96a73e 100644 --- a/modules/swagger-codegen/src/main/resources/python/api_client.mustache +++ b/modules/swagger-codegen/src/main/resources/python/api_client.mustache @@ -187,9 +187,12 @@ class ApiClient(object): :param obj: The data to serialize. :return: The serialized form of data. """ + types = (str, int, float, bool, tuple) + if sys.version_info < (3,0): + types = types + (unicode,) if isinstance(obj, type(None)): return None - elif isinstance(obj, (str, int, float, bool, tuple, unicode)): + elif isinstance(obj, types): return obj elif isinstance(obj, list): return [self.sanitize_for_serialization(sub_obj)