2 ms·
Do you mean, that vs something like this? responses = HTTPX.get("/page1"). get("/page2"). start My guess is th
by pmontra 7y ago
Do you mean, that vs something like this?
responses = HTTPX.get("/page1").
get("/page2").
start
My guess is that the focus of HTTPX being parallel requests, the author choose an API that explicitly groups them together. The documentation is pretty sparse, I wonder if we can pass an array of URLs to get().
- fouc 7y agoyes, ruby has a splat * operator that will basically expand an array into a set of arguments. array = ["https://news.ycombinator.com/news", "https://news.ycombinator.com/news?p=2", "https://news.ycombinator.com/news?p=3"] page1, page2, page3 = HTTPX.get(*array)
- stormbrew 7y agoNote you can also splat the return as well: *pages = HTTPX.get(*urls)
- lloeki 7y agosplat? urls = ['https://example.com/foo', 'https://example.com/bar'] HTTPX.get(*urls)