Execute concurrent requests
masterHTTPX supports concurrency by default. If you pass multiple URIs to a single method call, HTTPX will perform all requests simultaneously. It uses multiplexing on HTTP/2 sockets or HTTP/1.1 pipelining where possible to optimize performance.
Simultaneous requests (returning multiple responses):
page1, page2, page3 = HTTPX.get("https://news.ycombinator.com/news", "https://news.ycombinator.com/news?p=2", "https://news.ycombinator.com/news?p=3")Multiplexing requests to the same origin:
HTTPX.get(
"https://news.ycombinator.com/news",
"https://news.ycombinator.com/news?p=2",
"https://google.com/q=me"
) # The first two requests will be multiplexed on the same socket.