Allow generators or any iterators for async.map
authorShrikant Sharat Kandula <shrikantsharat.k@gmail.com>
Fri, 25 Nov 2011 02:15:12 +0000 (07:45 +0530)
committerShrikant Sharat Kandula <shrikantsharat.k@gmail.com>
Fri, 25 Nov 2011 02:15:12 +0000 (07:45 +0530)
requests/async.py

index 8bafb1ee8b66b0537a0aa21c9940256a8d538a46..c91025fc89f0ffab43a78e2177e91e3ac99793ce 100644 (file)
@@ -71,6 +71,8 @@ def map(requests, prefetch=True, size=None):
     :param size: Specifies the number of requests to make at a time. If None, no throttling occurs.
     """
 
+    requests = list(requests)
+
     if size:
         pool = Pool(size)
         pool.map(send, requests)