As far as I know, the difference between map and imap is that map waits for all requests to complete and then returns the ordered data. While imap returns data immediately and orders less.
When i use:
urls = [...some_data...] rs = (grequests.get(u,, hooks=dict(response=callback_f)) for u in urls) r = grequests.map(rs)
the hook is used as soon as all requests end and the callback function is called.
When i use:
urls = [...some_data...] rs = (grequests.get(u,, hooks=dict(response=callback_f)) for u in urls) r = grequests.imap(rs)
then no request is sent.
According to the documentation map and imap they have at their disposal the same API.
Is this the expected behavior? Shouldn't hooks be used with imap? I am using Python 3.5.
source share