From 000c8e6c4eedf046c601b81d5d8d82f92115eddd Mon Sep 17 00:00:00 2001 From: Ben Beasley Date: Tue, 29 Oct 2024 08:13:56 -0400 Subject: [PATCH] fix(starlette): Prefer python_multipart import over multipart (#3710) See also releases 0.0.13 through 0.0.16 at https://github.com/Kludex/python-multipart/releases. --------- Co-authored-by: Daniel Szoke --- sentry_sdk/integrations/starlette.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sentry_sdk/integrations/starlette.py b/sentry_sdk/integrations/starlette.py index 52c64f6843..d9db8bd6b8 100644 --- a/sentry_sdk/integrations/starlette.py +++ b/sentry_sdk/integrations/starlette.py @@ -65,7 +65,12 @@ try: # Optional dependency of Starlette to parse form data. - import multipart # type: ignore + try: + # python-multipart 0.0.13 and later + import python_multipart as multipart # type: ignore + except ImportError: + # python-multipart 0.0.12 and earlier + import multipart # type: ignore except ImportError: multipart = None