kennethreitz/requests — pull request #1247 by ross (2013-03-16 17:28:43+00:00)
Title: proof of concept async requests via futures

this is a proposal/proof of concept. by no means is it expected to be merged.

it provides a FuturesSession which returns concurrent.futures.Future objects to calls in place of requests.Response. this provides a near seamless async requests api.

an example:

session = FuturesSession()
future = session.get('http://www.foo.com/bar/')
... do other stuff ...
# wait for response or return immediately if it's already back
response = future.result()
... continue as normal ...

as currently implemented it requires no external dependancies and uses the python3 futures, tested with python 3.3.0. if desired support could be added to 2.x releases by either using the backport of futures or without dependancies using methods similar to https://github.com/ross/python-asynchttp.

feedback solicited.

best,
--
-rm