As far as I know the difference between map
and imap
is that map
waits for all requests to finish and then returns the ordered data. Whereas imap
returns data immediately and order 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 finish, 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 not a single request is sent.
According to the documentation map and imap have excatly the same API.
Is this the expected behavior? Should I not use hooks with imap? I am using Python 3.5.