diff --git a/flask_restx/api.py b/flask_restx/api.py index e7b08e22..4221db39 100644 --- a/flask_restx/api.py +++ b/flask_restx/api.py @@ -34,7 +34,13 @@ NotAcceptable, InternalServerError, ) -from werkzeug.wrappers import BaseResponse + +from werkzeug import __version__ as werkzeug_version + +if werkzeug_version.split('.')[0] >= '2': + from werkzeug.wrappers import Response as BaseResponse +else: + from werkzeug.wrappers import BaseResponse from . import apidoc from .mask import ParseError, MaskError diff --git a/flask_restx/resource.py b/flask_restx/resource.py index 991b7a68..4d0b4032 100644 --- a/flask_restx/resource.py +++ b/flask_restx/resource.py @@ -3,7 +3,12 @@ from flask import request from flask.views import MethodView -from werkzeug.wrappers import BaseResponse +from werkzeug import __version__ as werkzeug_version + +if werkzeug_version.split('.')[0] >= '2': + from werkzeug.wrappers import Response as BaseResponse +else: + from werkzeug.wrappers import BaseResponse from .model import ModelBase diff --git a/requirements/install.pip b/requirements/install.pip index b3453104..e7a7cb13 100644 --- a/requirements/install.pip +++ b/requirements/install.pip @@ -1,8 +1,8 @@ aniso8601==8.0.0; python_version < '3.5' aniso8601>=0.82; python_version >= '3.5' jsonschema -Flask>=0.8, <2.0.0 -werkzeug <2.0.0 +Flask>=0.8, !=2.0.0 +werkzeug !=2.0.0 pytz six>=1.3.0 enum34; python_version < '3.4'