diff --git a/modules/swagger-codegen/src/main/resources/python/rest.mustache b/modules/swagger-codegen/src/main/resources/python/rest.mustache index 6c2c21d3055..b801938dc52 100644 --- a/modules/swagger-codegen/src/main/resources/python/rest.mustache +++ b/modules/swagger-codegen/src/main/resources/python/rest.mustache @@ -206,7 +206,7 @@ class RESTClientObject(object): # log response body logger.debug("response body: %s", r.data) - if r.status not in range(200, 206): + if not 200 <= r.status <= 299: raise ApiException(http_resp=r) return r diff --git a/samples/client/petstore/python/petstore_api/rest.py b/samples/client/petstore/python/petstore_api/rest.py index 3ed3cf31849..c567f731294 100644 --- a/samples/client/petstore/python/petstore_api/rest.py +++ b/samples/client/petstore/python/petstore_api/rest.py @@ -215,7 +215,7 @@ class RESTClientObject(object): # log response body logger.debug("response body: %s", r.data) - if r.status not in range(200, 206): + if not 200 <= r.status <= 299: raise ApiException(http_resp=r) return r