We are passing (page transition) values in Python's CGI.
We are currently retrieving the value in
However, since Python 3.11, cgi has been deprecated, and since 3.13, it has been deprecated completely.
import cgi on Python 3.11, the following error appears:
I thought of doing something else before it was discontinued, so I tried requests, but I don't know how to receive them.Is there any good way?
Thank you for your cooperation.
Windows Server 2012
The current method is as follows.
Submit with test.html and receive values at test.py.
test.pypython python3 cgi
Python is not very familiar, so I just looked it up a little bit.
The cgi module retirement document contained relevant statements.
There seems to be no module to replace cgi completely.
Depending on the feature you want to use, you can use multipart or urlib.parse.parse_qsl for this example.
Excerpts only relevant to the question:
Replacements for the variable parts of cgi which are not directly related to executing code are:
MiniFieldStoragehas no direct replacement, but can be replaced by using multipart(for POST and PUT request_request) and pulse.
Or, there seems to be a module called legacy-cgi that forked the existing cgi.The purpose seems to be to continue supporting existing CGI scripts, but it also says, "Consider migrating to WSGI."
© 2022 OneMinuteCode. All rights reserved.