Skip to content Skip to sidebar Skip to footer

Pipelining Post Requests With Python-requests

Assuming that I can verify that a bunch of POST requests are in fact logically independent, how can I set up HTTP pipelining using python-requests and force it to allow POST reques

Solution 1:

Pipelining requests can be done with the builtin httplib, but only by accessing the connection and response objects below their public interface. This snippet demonstrates.

Edit: updated version for Python3: https://github.com/urllib3/urllib3/issues/52#issuecomment-109756116

Solution 2:

The requests library does not support HTTP pipelining.

You can approximate pipelining by using grequests which makes it easier to run many requests in parallel, but each parallel request would still use a new TCP connection.

(requests does pool connections, keeping the TCP connection open if the remote server permits this, but that only helps for sequential connections, and request and response still have to alternate).

Post a Comment for "Pipelining Post Requests With Python-requests"