hugapi / hug

Embrace the APIs of the future. Hug aims to make developing APIs as simple as possible, but no simpler.
MIT License
6.86k stars 388 forks source link

FYI: cgi module is deprecated in Python 3.11, will be removed in 3.13 #914

Open exoosh opened 1 year ago

exoosh commented 1 year ago

Source for the information: https://docs.python.org/3/library/cgi.html

cgi — Common Gateway Interface support

Source code: Lib/cgi.py

Deprecated since version 3.11, will be removed in version 3.13: The cgi module is deprecated (see PEP 594 for details and alternatives).

cgi.parse_multipart() is currently used in input_format.py, for example.

As a side note, this use also causes issues if you are trying to upload several GiB of data through a POST. The documentation for the method says:

This is easy to use but not much good if you are expecting megabytes to be uploaded — in that case, use the FieldStorage class instead which is much more flexible.

For hug the best option seems to be to use email.message instead.