When I download a file using single request I do the following:
session = requests.Session()
params = {'fd': 1, 'count': 1024, 'auth': 'auth_token'}
r = session.get('https://httpbin.org/bytes/9', params=params)
print(r.content)
# b'\xb3_\\l\xe2\xbf/:\x07'
How can I do multiple requests without waiting for an answer?
Server api docs says:
You can push multiple requests over single connection without waiting for answer, to improve performance. The server will process the requests in the order they are received and you are guaranteed to receive answers in the same order. It is important however to send all requests with "Connection: keep-alive", otherwise the API server will close the connection without processing the pending requests.
They are talking about one thread and multiple requests without waiting for an answer. I suppose it is called HTTP pipelining.
How can I do this with Python Requests library?
A similar answer suggests using parallel calls which is not the case for my question. It also says: "requests does pool connections, keeping the TCP connection open". How can I implement this?
Can I use any other synchronous library, if it's not possible for requests?