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