Metadata-Version: 2.0
Name: aiothrottle
Version: 0.1.1
Summary: Throttling, flow controlling StreamReader for aiohttp
Home-page: https://github.com/panda73111/aiothrottle
Author: Sebastian Hüther
Author-email: sebastian.huether@gmx.de
License: GPLv3
Download-URL: https://github.com/panda73111/aiothrottle/archive/v0.1.1.tar.gz
Keywords: throttle bandwidth limit download http throughput asyncio aiohttp
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.3
Classifier: Programming Language :: Python :: 3.4
Requires-Dist: aiohttp

Throttling, flow controlling StreamReader for aiohttp
=====================================================

.. image:: https://img.shields.io/pypi/v/aiothrottle.svg
    :target: https://pypi.python.org/pypi/aiothrottle

.. image:: https://readthedocs.org/projects/aiothrottle/badge/?version=latest
    :target: https://readthedocs.org/projects/aiothrottle/?badge=latest
    :alt: Documentation Status

.. image:: https://img.shields.io/pypi/pyversions/aiothrottle.svg
    :target: https://www.python.org/

.. image:: https://img.shields.io/pypi/l/aiothrottle.svg
    :target: http://opensource.org/licenses/GPL-3.0

Requirements
------------

- Python >= 3.3
- asyncio https://pypi.python.org/pypi/asyncio
- aiohttp https://pypi.python.org/pypi/aiohttp


License
-------

``aiothrottle`` is offered under the GPL v3 license.


Documentation
-------------

https://aiothrottle.readthedocs.org/


Source code
-----------

The latest developer version is available in a github repository:
https://github.com/panda73111/aiothrottle


Usage
-----

.. code:: python

    import aiohttp
    import aiothrottle

    # setup the rate limit to 200 KB/s
    aiothrottle.limit_rate(200 * 1024)

    # download a large file without blocking bandwidth
    response = aiohttp.request("GET", "http://example.com/largefile.zip")
    with open("largefile.zip", "wb") as file:
        read_next = True
        while read_next:
            # read 1 MB chunks
            chunk = response.content.read(2**20)
            file.write(chunk)
            read_next = len(chunk) != 0
    response.close()

    # unset the rate limit
    aiothrottle.unlimit_rate()


TODO
----

- Unit tests
- Upload rate limiting class
- General socket limiting class

CHANGES
=======

0.1.1 (08-02-2015)
------------------

- Added limit_rate() and unlimit_rate() globally and response-wise

- Raising ValueError on invalid rate limit

- Cancelling _check_handle in Throttle's destructor

0.1.0 (08-01-2015)
------------------

- Initial release with basic throttling functionality

