@@ -117,6 +117,31 @@ Removed
117
117
118
118
* :pep: `594 `: Remove the :mod: `!cgi` ` and :mod: `!cgitb ` modules,
119
119
deprecated in Python 3.11.
120
+
121
+ * ``cgi.FieldStorage `` can typically be replaced with
122
+ :func: `urllib.parse.parse_qsl ` for ``GET `` and ``HEAD `` requests, and the
123
+ :mod: `email.message ` module or `multipart
124
+ <https://pypi.org/project/multipart/> `__ PyPI project for ``POST `` and
125
+ ``PUT ``.
126
+
127
+ * ``cgi.parse() `` can be replaced by calling :func: `urllib.parse.parse_qs `
128
+ directly on the desired query string, except for ``multipart/form-data ``
129
+ input, which can be handled as described for ``cgi.parse_multipart() ``.
130
+
131
+ * ``cgi.parse_multipart() `` can be replaced with the functionality in the
132
+ :mod: `email ` package (e.g. :class: `email.message.EmailMessage ` and
133
+ :class: `email.message.Message `) which implements the same MIME RFCs, or
134
+ with the `multipart <https://pypi.org/project/multipart/ >`__ PyPI project.
135
+
136
+ * ``cgi.parse_header() `` can be replaced with the functionality in the
137
+ :mod: `email ` package, which implements the same MIME RFCs. For example,
138
+ with :class: `email.message.EmailMessage `::
139
+
140
+ from email.message import EmailMessage
141
+ msg = EmailMessage()
142
+ msg['content-type'] = 'application/json; charset="utf8"'
143
+ main, params = msg.get_content_type(), msg['content-type'].params
144
+
120
145
(Contributed by Victor Stinner in :gh: `104773 `.)
121
146
122
147
0 commit comments