Skip to content

Commit d0d737a

Browse files
shulcsmmvantellingen
authored andcommitted
Get rid of deprecated cgi module.
Uses email module as suggested in docs: https://docs.python.org/3/library/cgi.html#cgi.parse_header Fixes #1352
1 parent 5547801 commit d0d737a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/zeep/utils.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import cgi
1+
from email.message import Message
22
import inspect
33
import typing
44

@@ -90,5 +90,8 @@ def detect_soap_env(envelope):
9090

9191
def get_media_type(value):
9292
"""Parse a HTTP content-type header and return the media-type"""
93-
main_value, parameters = cgi.parse_header(value)
94-
return main_value.lower()
93+
msg = Message()
94+
msg['content-type'] = value
95+
96+
return msg.get_content_type()
97+

0 commit comments

Comments
 (0)