Skip to content

Commit 5ad9cf6

Browse files
committed
Explain how to port existing code
1 parent 10b3f34 commit 5ad9cf6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Doc/whatsnew/3.13.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,31 @@ Removed
120120

121121
* :pep:`594`: Remove the :mod:`!cgi`` and :mod:`!cgitb` modules,
122122
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+
123148
(Contributed by Victor Stinner in :gh:`104773`.)
124149

125150

0 commit comments

Comments
 (0)