Throttling, flow controlling StreamReader for aiohttp
Project description
aiothrottle
Throttling, flow controlling StreamReader for aiohttp
Requirements
Python >= 3.3
License
aiothrottle is offered under the GPL v3 license.
Documentation
Source code
The latest developer version is available in a github repository: https://github.com/panda73111/aiothrottle
Usage
import asyncio
import aiohttp
import aiothrottle
@asyncio.coroutine
def load_file(url):
response = yield from aiohttp.request("GET", url)
data = yield from response.read()
with open("largefile.zip", "wb") as file:
file.write(data)
response.close()
# setup the rate limit to 200 KB/s
aiothrottle.limit_rate(200 * 1024)
# download a large file without blocking bandwidth
loop = asyncio.get_event_loop()
loop.run_until_complete(load_file(
"http://example.com/largefile.zip"))
# unset the rate limit
aiothrottle.unlimit_rate()
TODO
Upload rate limiting class
General socket limiting class
CHANGES
0.1.2 (08-08-2015)
Fixed resuming transport too often
Added ‘rate_limit’ and ‘throttling’ properties
Fixed buffer limit control
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for aiothrottle-0.1.2.post0-py3.4.egg
Algorithm | Hash digest | |
---|---|---|
SHA256 | 75ea1f70a8914a48a58ade5f81e5ae8537eaa5e6d77049bc3d4a038187864e5a |
|
MD5 | 75e38aa3d15aac6db94280e3358db2bf |
|
BLAKE2b-256 | 9d91ef0644c7725834a4a95658a2c6a351d59269cf4975d23ce983632dbf49e1 |
Hashes for aiothrottle-0.1.2.post0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e840abe2c826acc488d7a168ed5a287fd48c5b0d04543a9f2f647e84b8300d0f |
|
MD5 | 54d2b592e54ae57a55cfe30c53174127 |
|
BLAKE2b-256 | 69fe7ff98027e0996f8062d2c6df154e55273e3b3d069f202e6b3b5743a27dc1 |