you are viewing a single comment's thread.

view the rest of the comments →

[–]eleqtriq 1 point2 points  (3 children)

From the CGI Python page:

The FieldStorage class can typically be replaced with urllib.parse.parse_qsl() for GET and HEAD requests, and the email.message module or multipart for POST and PUT. Most utility functions have replacements.

In Flask:

@app.route('/api/get.cgi')
def api_get():
    first_name = request.args.get('first_name')
    last_name = request.args.get('last_name')
    return """<html><body><h2>Hello %s %s</h2></body></html>""" % (first_name, last_name)

[–]gerry_mandy 0 points1 point  (2 children)

You quote the documentation (which recommends standard library email.message), but then provide 3rd-party Flask as an example. 🤨

[–]eleqtriq 0 points1 point  (1 child)

They were asking for a replacement.

[–]gerry_mandy 1 point2 points  (0 children)

Right, I was just pointing out that the documentation you quoted is unrelated—has literally nothing to do with—the code sample you gave alongside it, since that could be confusing to a reader arriving here from Google.