1919 The :mod: `cgi ` module is deprecated
2020 (see :pep: `PEP 594 <594#cgi >` for details and alternatives).
2121
22+ The :class: `FieldStorage ` class can typically be replaced with
23+ :func: `urllib.parse.parse_qsl ` for ``GET `` and ``HEAD `` requests,
24+ and the :mod: `email.message ` module or
25+ `multipart <https://pypi.org/project/multipart/ >`_ for ``POST `` and ``PUT ``.
26+ Most :ref: `utility functions <functions-in-cgi-module >` have replacements.
27+
2228--------------
2329
2430Support module for Common Gateway Interface (CGI) scripts.
@@ -293,6 +299,12 @@ algorithms implemented in this module in other circumstances.
293299 ``sys.stdin ``). The *keep_blank_values *, *strict_parsing * and *separator * parameters are
294300 passed to :func: `urllib.parse.parse_qs ` unchanged.
295301
302+ .. deprecated-removed :: 3.11 3.13
303+ This function, like the rest of the :mod: `cgi ` module, is deprecated.
304+ It can be replaced by calling :func: `urllib.parse.parse_qs ` directly
305+ on the desired query string (except for ``multipart/form-data `` input,
306+ which can be handled as described for :func: `parse_multipart `).
307+
296308
297309.. function :: parse_multipart(fp, pdict, encoding="utf-8", errors="replace", separator="&")
298310
@@ -316,12 +328,31 @@ algorithms implemented in this module in other circumstances.
316328 .. versionchanged :: 3.10
317329 Added the *separator * parameter.
318330
331+ .. deprecated-removed :: 3.11 3.13
332+ This function, like the rest of the :mod: `cgi ` module, is deprecated.
333+ It can be replaced with the functionality in the :mod: `email ` package
334+ (e.g. :class: `email.message.EmailMessage `/:class: `email.message.Message `)
335+ which implements the same MIME RFCs, or with the
336+ `multipart <https://pypi.org/project/multipart/ >`__ PyPI project.
337+
319338
320339.. function :: parse_header(string)
321340
322341 Parse a MIME header (such as :mailheader: `Content-Type `) into a main value and a
323342 dictionary of parameters.
324343
344+ .. deprecated-removed :: 3.11 3.13
345+ This function, like the rest of the :mod: `cgi ` module, is deprecated.
346+ It can be replaced with the functionality in the :mod: `email ` package,
347+ which implements the same MIME RFCs.
348+
349+ For example, with :class: `email.message.EmailMessage `::
350+
351+ from email.message import EmailMessage
352+ msg = EmailMessage()
353+ msg['content-type'] = 'application/json; charset="utf8"'
354+ main, params = msg.get_content_type(), msg['content-type'].params
355+
325356
326357.. function :: test()
327358
0 commit comments