Skip to content

Commit 331c7a7

Browse files
Prefer python_multipart import over multipart
See: Kludex/python-multipart#16 See also releases 0.0.13 through 0.0.16 at https://github.com/Kludex/python-multipart/releases.
1 parent b6482f0 commit 331c7a7

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

sentry_sdk/integrations/starlette.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,14 @@
6565

6666
try:
6767
# Optional dependency of Starlette to parse form data.
68-
import multipart # type: ignore
68+
try:
69+
# python-multipart 0.0.13 and later
70+
import python_multipart # type: ignore
71+
except ImportError:
72+
# python-multipart 0.0.12 and later
73+
import multipart as python_multipart # type: ignore
6974
except ImportError:
70-
multipart = None
75+
python_multipart = None
7176

7277

7378
_DEFAULT_TRANSACTION_NAME = "generic Starlette request"
@@ -657,7 +662,7 @@ def cookies(self):
657662

658663
async def form(self):
659664
# type: (StarletteRequestExtractor) -> Any
660-
if multipart is None:
665+
if python_multipart is None:
661666
return None
662667

663668
# Parse the body first to get it cached, as Starlette does not cache form() as it

0 commit comments

Comments
 (0)