I tried the sample provided within the documentation of the requests library for python.
With async.map(rs), I get the response codes, but I want to get the content of each page requested. This, for example, does not work:
out = async.map(rs)
print out[0].content
Note
The below answer is not applicable to requests v0.13.0+. The asynchronous functionality was moved to grequests after this question was written. However, you could just replace
requestswithgrequestsbelow and it should work.I’ve left this answer as is to reflect the original question which was about using requests < v0.13.0.
To do multiple tasks with
async.mapasynchronously you have to:async.mapon a list of all the requests / actionsExample: