Skip to content
Myr

Merge https://github.com/juanriaza/requests into develop

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parents 30ed664, 6fefffd · Browse files · 1 file+10 added−3 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+10 added−3 removed

  • other:+10 added−3 removed

1 file+10 added−3 removed

modified:requests/async.py+10 added-3 removed
10 unmodified lines
1112try:13 import gevent14 from gevent import monkey as curious_george15 from gevent.pool import Pool16except ImportError:17 raise RuntimeError('Gevent is required for requests.async.')1819# Monkey-patch.
43 unmodified lines
63delete = patched(api.delete)64request = patched(api.request)656666def map(requests, prefetch=True):67def map(requests, prefetch=True, size=None):68 """Concurrently converts a list of Requests to Responses.6970 :param requests: a collection of Request objects.71 :param prefetch: If False, the content will not be downloaded immediately.72 :param size: Specifies the number of requests to make at a time. If None, no throttling occurs.73 """7475 if size:76 pool = Pool(size)77 pool.map(send, requests)78 pool.join()79 else:73 jobs = [gevent.spawn(send, r) for r in requests]74 gevent.joinall(jobs)80 jobs = [gevent.spawn(send, r) for r in requests]81 gevent.joinall(jobs)8283 if prefetch:84 [r.response.content for r in requests]85
5 unmodified lines