diff --git a/modules/openapi-generator/src/main/resources/python/api_client.mustache b/modules/openapi-generator/src/main/resources/python/api_client.mustache index 95fef884bc1..1c204ad1595 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -234,6 +234,9 @@ class ApiClient(object): # data needs deserialization or returns HTTP data (deserialized) only if _preload_content or _return_http_data_only: response_type = response_types_map.get(str(response_data.status), None) + if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) if response_type == "bytearray": response_data.data = response_data.data diff --git a/samples/client/echo_api/python/openapi_client/api_client.py b/samples/client/echo_api/python/openapi_client/api_client.py index 1b315709ffe..3f407664d47 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -227,6 +227,9 @@ class ApiClient(object): # data needs deserialization or returns HTTP data (deserialized) only if _preload_content or _return_http_data_only: response_type = response_types_map.get(str(response_data.status), None) + if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) if response_type == "bytearray": response_data.data = response_data.data diff --git a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py index daa972358f7..66ae38bf984 100644 --- a/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python-aiohttp/petstore_api/api_client.py @@ -227,6 +227,9 @@ class ApiClient(object): # data needs deserialization or returns HTTP data (deserialized) only if _preload_content or _return_http_data_only: response_type = response_types_map.get(str(response_data.status), None) + if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) if response_type == "bytearray": response_data.data = response_data.data diff --git a/samples/openapi3/client/petstore/python/petstore_api/api_client.py b/samples/openapi3/client/petstore/python/petstore_api/api_client.py index 4096fc43c20..9fbad9a8d76 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -226,6 +226,9 @@ class ApiClient(object): # data needs deserialization or returns HTTP data (deserialized) only if _preload_content or _return_http_data_only: response_type = response_types_map.get(str(response_data.status), None) + if not response_type and type(response_data.status) == int and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) if response_type == "bytearray": response_data.data = response_data.data