Metadata-Version: 2.4
Name: requests-threads
Version: 0.1.1
Summary: A Requests session that returns awaitable Twisted Deferreds instead of response objects.
Home-page: https://github.com/requests/requests/requests-threads
Author: Kenneth Reitz
Author-email: me@kennethreitz.org
License: ISC
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.6
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Dist: requests
Requires-Dist: twisted
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: home-page
Dynamic: license
Dynamic: requires-dist
Dynamic: summary


requests-threads 🎭
===================

This repo contains a Requests session that returns awaitable Twisted
Deferreds instead of Response objects.

It's awesome, basically — check it out:

Examples
--------

Example Usage (using ``async``/``await``):

.. code:: python

	from requests_threads import AsyncSession

	session = AsyncSession()

	async def _main():
	    rs = []
	    for _ in range(100):
	        rs.append(await session.get('http://httpbin.org/get'))
	    print(rs)

	if __name__ == '__main__':
	    session.run(_main)

*This example works on Python 3 only.*

Example Usage (using Twisted):

.. code:: python

	from twisted.internet.defer import inlineCallbacks
	from twisted.internet.task import react
	import requests

	session = requests.AsyncSession(n=100)

	@inlineCallbacks
	def main(reactor):
	    responses = []
	    for i in range(100):
	        responses.append(session.get('http://httpbin.org/get'))

	    for response in responses:
	        r = yield response
	        print(r)

	if __name__ == '__main__':
	    react(main)

*This example works on Python 2 and Python 3.*

--------------------

Each request is sent via a new thread, automatically. This works fine for basic
use cases. This automatically uses Twisted's ``asyncioreactor``, if you do not
provide your own reactor (progress to be made there, help requested!).

**This is a an experiment**, and a preview of the true asyncronous API we have panned for Requests
that is currently *in the works*, but requires a lot of development time. If you'd like to help (p.s. **we need help**, `send me an email <mailto:me@kennethreitz.org>`_).

This API is likely to change, over time, slightly.

Installation
------------

::

    $ pipenv install requests-threads
    ✨🍰✨
