python - Are grequests responses in the same order as the requests? -
i using grequests asynchronously download data website using same url different parameters.
for example,
unsent_requests = [] param in params: # assume params list containing different parameters or query strings unsent_requests.append(grequests.get(url = url, params = param)) responses = grequests.map(unsent)
how can possibly know response responses belongs request unsent_requests? or responses in same order unsent requests?
ps: response.url not give clue because different url returns.
responses in same order requests, shown in usage example:
>>> reqs = [ ... grequests.get('http://httpbin.org/delay/1', timeout=0.001), ... grequests.get('http://fakedomain/'), ... grequests.get('http://httpbin.org/status/500')] >>> grequests.map(reqs, exception_handler=exception_handler) request failed request failed [none, none, <response [500]>]
Comments
Post a Comment