From c589d8a251868d983ecf97b2fbffff0e9f29e56c Mon Sep 17 00:00:00 2001 From: Daniel Miller Date: Thu, 7 Jun 2012 16:47:54 -0700 Subject: [PATCH] If this comment is true (https://github.com/kennethreitz/requests/issues/239#issuecomment-6180706), then it would be good to point people in the right direction. Otherwise disregard this message. --- docs/user/advanced.rst | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/docs/user/advanced.rst b/docs/user/advanced.rst index fe5e19e..ac8ab98 100644 --- a/docs/user/advanced.rst +++ b/docs/user/advanced.rst @@ -107,43 +107,8 @@ If you'd like to disable keep-alive, you can simply set the ``keep_alive`` confi Asynchronous Requests ---------------------- -Requests has first-class support for concurrent requests, powered by gevent. -This allows you to send a bunch of HTTP requests at the same time. -First, let's import the async module. Heads up — if you don't have -`gevent `_ this will fail:: - - from requests import async - -The ``async`` module has the exact same api as ``requests``, except it -doesn't send the request immediately. Instead, it returns the ``Request`` -object. - -We can build a list of ``Request`` objects easily:: - - urls = [ - 'http://python-requests.org', - 'http://httpbin.org', - 'http://python-guide.org', - 'http://kennethreitz.com' - ] - - rs = [async.get(u) for u in urls] - -Now we have a list of ``Request`` objects, ready to be sent. We could send them -one at a time with ``Request.send()``, but that would take a while. Instead, -we'll send them all at the same time with ``async.map()``. Using ``async.map()`` -will also guarantee execution of the ``response`` hook, described below. :: - - >>> responses = async.map(rs) - >>> responses - [, , , ] - -.. admonition:: Throttling - - The ``map`` function also takes a ``size`` parameter, that specifies the number of connections to make at a time:: - - async.map(rs, size=5) +``requests.async`` has been removed from requests and is now its own repository named `GRequests `_. Event Hooks -- 2.34.1