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 8df24870123..3da894ae0ef 100644 --- a/modules/openapi-generator/src/main/resources/python/api_client.mustache +++ b/modules/openapi-generator/src/main/resources/python/api_client.mustache @@ -304,23 +304,22 @@ class ApiClient: # if not found, look for '1XX', '2XX', etc. response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - if response_type is None: - if not 200 <= response_data.status <= 299: - if response_data.status == 400: - raise BadRequestException(http_resp=response_data) + if not 200 <= response_data.status <= 299: + if response_data.status == 400: + raise BadRequestException(http_resp=response_data) - if response_data.status == 401: - raise UnauthorizedException(http_resp=response_data) + if response_data.status == 401: + raise UnauthorizedException(http_resp=response_data) - if response_data.status == 403: - raise ForbiddenException(http_resp=response_data) + if response_data.status == 403: + raise ForbiddenException(http_resp=response_data) - if response_data.status == 404: - raise NotFoundException(http_resp=response_data) + if response_data.status == 404: + raise NotFoundException(http_resp=response_data) - if 500 <= response_data.status <= 599: - raise ServiceException(http_resp=response_data) - raise ApiException(http_resp=response_data) + if 500 <= response_data.status <= 599: + raise ServiceException(http_resp=response_data) + raise ApiException(http_resp=response_data) # deserialize response data diff --git a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py index d1063c0d147..cee9963034e 100644 --- a/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py +++ b/samples/client/echo_api/python-disallowAdditionalPropertiesIfNotPresent-true/openapi_client/api_client.py @@ -297,23 +297,22 @@ class ApiClient: # if not found, look for '1XX', '2XX', etc. response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - if response_type is None: - if not 200 <= response_data.status <= 299: - if response_data.status == 400: - raise BadRequestException(http_resp=response_data) + if not 200 <= response_data.status <= 299: + if response_data.status == 400: + raise BadRequestException(http_resp=response_data) - if response_data.status == 401: - raise UnauthorizedException(http_resp=response_data) + if response_data.status == 401: + raise UnauthorizedException(http_resp=response_data) - if response_data.status == 403: - raise ForbiddenException(http_resp=response_data) + if response_data.status == 403: + raise ForbiddenException(http_resp=response_data) - if response_data.status == 404: - raise NotFoundException(http_resp=response_data) + if response_data.status == 404: + raise NotFoundException(http_resp=response_data) - if 500 <= response_data.status <= 599: - raise ServiceException(http_resp=response_data) - raise ApiException(http_resp=response_data) + if 500 <= response_data.status <= 599: + raise ServiceException(http_resp=response_data) + raise ApiException(http_resp=response_data) # deserialize response 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 d1063c0d147..cee9963034e 100644 --- a/samples/client/echo_api/python/openapi_client/api_client.py +++ b/samples/client/echo_api/python/openapi_client/api_client.py @@ -297,23 +297,22 @@ class ApiClient: # if not found, look for '1XX', '2XX', etc. response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - if response_type is None: - if not 200 <= response_data.status <= 299: - if response_data.status == 400: - raise BadRequestException(http_resp=response_data) + if not 200 <= response_data.status <= 299: + if response_data.status == 400: + raise BadRequestException(http_resp=response_data) - if response_data.status == 401: - raise UnauthorizedException(http_resp=response_data) + if response_data.status == 401: + raise UnauthorizedException(http_resp=response_data) - if response_data.status == 403: - raise ForbiddenException(http_resp=response_data) + if response_data.status == 403: + raise ForbiddenException(http_resp=response_data) - if response_data.status == 404: - raise NotFoundException(http_resp=response_data) + if response_data.status == 404: + raise NotFoundException(http_resp=response_data) - if 500 <= response_data.status <= 599: - raise ServiceException(http_resp=response_data) - raise ApiException(http_resp=response_data) + if 500 <= response_data.status <= 599: + raise ServiceException(http_resp=response_data) + raise ApiException(http_resp=response_data) # deserialize response 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 8f779d0509b..fa4caabb835 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 @@ -299,23 +299,22 @@ class ApiClient: # if not found, look for '1XX', '2XX', etc. response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - if response_type is None: - if not 200 <= response_data.status <= 299: - if response_data.status == 400: - raise BadRequestException(http_resp=response_data) + if not 200 <= response_data.status <= 299: + if response_data.status == 400: + raise BadRequestException(http_resp=response_data) - if response_data.status == 401: - raise UnauthorizedException(http_resp=response_data) + if response_data.status == 401: + raise UnauthorizedException(http_resp=response_data) - if response_data.status == 403: - raise ForbiddenException(http_resp=response_data) + if response_data.status == 403: + raise ForbiddenException(http_resp=response_data) - if response_data.status == 404: - raise NotFoundException(http_resp=response_data) + if response_data.status == 404: + raise NotFoundException(http_resp=response_data) - if 500 <= response_data.status <= 599: - raise ServiceException(http_resp=response_data) - raise ApiException(http_resp=response_data) + if 500 <= response_data.status <= 599: + raise ServiceException(http_resp=response_data) + raise ApiException(http_resp=response_data) # deserialize response 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 87f81c87199..bdf72703ea2 100755 --- a/samples/openapi3/client/petstore/python/petstore_api/api_client.py +++ b/samples/openapi3/client/petstore/python/petstore_api/api_client.py @@ -296,23 +296,22 @@ class ApiClient: # if not found, look for '1XX', '2XX', etc. response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) - if response_type is None: - if not 200 <= response_data.status <= 299: - if response_data.status == 400: - raise BadRequestException(http_resp=response_data) + if not 200 <= response_data.status <= 299: + if response_data.status == 400: + raise BadRequestException(http_resp=response_data) - if response_data.status == 401: - raise UnauthorizedException(http_resp=response_data) + if response_data.status == 401: + raise UnauthorizedException(http_resp=response_data) - if response_data.status == 403: - raise ForbiddenException(http_resp=response_data) + if response_data.status == 403: + raise ForbiddenException(http_resp=response_data) - if response_data.status == 404: - raise NotFoundException(http_resp=response_data) + if response_data.status == 404: + raise NotFoundException(http_resp=response_data) - if 500 <= response_data.status <= 599: - raise ServiceException(http_resp=response_data) - raise ApiException(http_resp=response_data) + if 500 <= response_data.status <= 599: + raise ServiceException(http_resp=response_data) + raise ApiException(http_resp=response_data) # deserialize response data