diff --git a/azure/functions/_http.py b/azure/functions/_http.py index 9cae82d7..49faea60 100644 --- a/azure/functions/_http.py +++ b/azure/functions/_http.py @@ -8,10 +8,10 @@ import types import typing -from multidict._multidict import MultiDict +import werkzeug.datastructures from werkzeug import formparser as _wk_parser from werkzeug import http as _wk_http -from werkzeug.datastructures import Headers, FileStorage +from werkzeug.datastructures import Headers, FileStorage, MultiDict from . import _abc @@ -175,8 +175,8 @@ def __init__(self, self.__route_params = types.MappingProxyType(route_params or {}) self.__body_bytes = body self.__form_parsed = False - self.__form: MultiDict[str, str] = None - self.__files:MultiDict[str, FileStorage] = None + self.__form: MultiDict[str, str] + self.__files: MultiDict[str, FileStorage] @property def url(self): @@ -231,7 +231,8 @@ def _parse_form_data(self): content_length = len(body) mimetype, options = _wk_http.parse_options_header(content_type) parser = _wk_parser.FormDataParser( - _wk_parser.default_stream_factory + _wk_parser.default_stream_factory, None, None, + werkzeug.datastructures.ImmutableMultiDict ) body_stream = io.BytesIO(body) diff --git a/setup.py b/setup.py index 43d96c05..1e3af5b1 100644 --- a/setup.py +++ b/setup.py @@ -6,7 +6,12 @@ from setuptools import find_packages, setup from azure.functions import __version__ -INSTALL_REQUIRES = ["werkzeug"] +if sys.version_info[:2] >= (3, 9): + INSTALL_REQUIRES = ["werkzeug~=3.1.3"] +elif sys.version_info[:2] == (3, 8): + INSTALL_REQUIRES = ["werkzeug~=3.0.6"] +else: + INSTALL_REQUIRES = ["werkzeug"] EXTRA_REQUIRES = { 'dev': [