Skip to content

Commit

Permalink
Merge pull request #4 from EdwardBetts/cgi-is-deprecated
Browse files Browse the repository at this point in the history
Stop using the cgi module, it is deprecated
  • Loading branch information
pudo authored Feb 6, 2023
2 parents 74012d0 + 0b417c7 commit 708513f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pantomime/parse.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from cgi import parse_header
from email.message import EmailMessage
from typing import Any, Dict, Optional, Tuple
from normality import stringify
from normality.encoding import tidy_encoding
Expand Down Expand Up @@ -62,7 +62,10 @@ def parse(
mime_type = stringify(mime_type)
params = None
if mime_type is not None:
mime_type, params = parse_header(mime_type)
msg = EmailMessage()
msg['content-type'] = mime_type
mime_type = msg.get_content_type() if mime_type.count("/") == 1 else None
params = msg['content-type'].params

family, subtype = cls.split(mime_type)
if family is None:
Expand Down

0 comments on commit 708513f

Please sign in to comment.