• Simple module for python-based cgi?

    From Samuel Thibault@21:1/5 to All on Sat Jun 29 22:10:02 2024
    Hello,

    I used to use the cgi module to implement simple python-based cgi
    scripts for mere http forms. But it is getting deprecated https://peps.python.org/pep-0594/#cgi
    and concerning form support:

    FieldStorage/MiniFieldStorage has no direct replacement,
    but can typically be replaced by using multipart
    (https://pypi.org/project/multipart/) (for POST and PUT requests) or
    urllib.parse.parse_qsl (for GET and HEAD requests)

    But that multipart project doesn't seem to be packaged in Debian? (python-multipart seems to be something else, that doesn't seem to
    actually provide form content?)

    Do we actually have something in Debian python to replace cgi's
    FieldStorage in a simple way?

    Samuel

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Fay Stegerman@21:1/5 to All on Sat Jun 29 22:30:02 2024
    * Samuel Thibault <sthibault@debian.org> [2024-06-29 21:46]:
    I used to use the cgi module to implement simple python-based cgi
    scripts for mere http forms. But it is getting deprecated https://peps.python.org/pep-0594/#cgi
    and concerning form support:

    FieldStorage/MiniFieldStorage has no direct replacement,
    but can typically be replaced by using multipart
    (https://pypi.org/project/multipart/) (for POST and PUT requests) or
    urllib.parse.parse_qsl (for GET and HEAD requests)

    But that multipart project doesn't seem to be packaged in Debian? (python-multipart seems to be something else, that doesn't seem to
    actually provide form content?)

    Do we actually have something in Debian python to replace cgi's
    FieldStorage in a simple way?

    I haven't used it myself so I'm not sure it would fit your use case, and it might not exactly count as "simple", but Debian does have python3-requests-toolbelt which seems to provide a requests_toolbelt.multipart.decoder.MultipartDecoder.

    - Fay

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)