twisted / treq

Python requests like API built on top of Twisted's HTTP client.
Other
585 stars 137 forks source link

`cgi` is deprecated as of Python 3.11 #355

Closed twm closed 6 months ago

twm commented 1 year ago

There are two uses of the cgi module in treq:

  1. One use of cgi.parse_header() in treq.contentsuggested replacement is email.message.Message
  2. One use of cgi.parse_multipart() in treq.test.test_multipart — same suggested replacement
cjwatson commented 1 year ago

For cgi.parse_multipart, treq is likely to be better off using the multipart module from PyPI. email.message is often not quite right for HTTP form data, despite the similar encoding.

adiroiban commented 11 months ago

Does multipart support non-blocking API? I took a very quick look at the code and I don't see any callback/non-blocking support. Maybe I need to dig deeper.


I have this code that I am using in prod for my app https://gist.github.com/adiroiban/7f593d6d18113aae797ad081e07f4745 ... but this uses a fork of twisted web with support for replacing the custom content handler

If anyone is interested, I am happy to get something based on this code into twisted ... I also have tests for it.. but have not added them in the gist.