diff --git a/flask_restx/utils.py b/flask_restx/utils.py index 16aa940a..3016100f 100644 --- a/flask_restx/utils.py +++ b/flask_restx/utils.py @@ -25,6 +25,7 @@ class FlaskCompatibilityWarning(DeprecationWarning): pass + def merge(first, second): """ Recursively merges two dictionaries. @@ -135,6 +136,7 @@ def import_check_view_func(): actual method body remaining the same in each flask version. """ import importlib.metadata + flask_version = importlib.metadata.version("flask").split(".") def local_endpoint_from_view_func(view_func: typing.Callable) -> str: @@ -143,6 +145,7 @@ def local_endpoint_from_view_func(view_func: typing.Callable) -> str: """ assert view_func is not None, "expected view func if endpoint is not provided." return view_func.__name__ + try: if flask_version[0] == "1": from flask.helpers import _endpoint_from_view_func @@ -159,4 +162,3 @@ def local_endpoint_from_view_func(view_func: typing.Callable) -> str: if _endpoint_from_view_func is None: _endpoint_from_view_func = local_endpoint_from_view_func return _endpoint_from_view_func -