Skip to content

Commit

Permalink
Get rid of deprecated cgi module.
Browse files Browse the repository at this point in the history
Uses email module as suggested in docs: https://docs.python.org/3/library/cgi.html#cgi.parse_header
Fixes #1352
  • Loading branch information
shulcsm authored and mvantellingen committed Mar 17, 2023
1 parent 5547801 commit d0d737a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/zeep/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import cgi
from email.message import Message
import inspect
import typing

Expand Down Expand Up @@ -90,5 +90,8 @@ def detect_soap_env(envelope):

def get_media_type(value):
"""Parse a HTTP content-type header and return the media-type"""
main_value, parameters = cgi.parse_header(value)
return main_value.lower()
msg = Message()
msg['content-type'] = value

return msg.get_content_type()

0 comments on commit d0d737a

Please sign in to comment.