Throttling, flow controlling StreamReader for aiohttp
Project description
aiothrottle
Throttling, flow controlling StreamReader for aiohttp
Requirements
Python >= 3.4.2
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.3 (30-08-2016)
Set minimum required Python version to 3.4.2, the same as aiohttp 1.0.0
Made aiothrottle compatible with current aiohttp version again (Now using aiohttp.StreamReader._buffer_size)
Catching RuntimeError when trying to pause a closing _SSLProtocolTransport
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
File details
Details for the file aiothrottle-0.1.3.zip
.
File metadata
- Download URL: aiothrottle-0.1.3.zip
- Upload date:
- Size: 54.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c28d9dc8a39de30c15a7fd1444525dce2e9706ad4c2c0844fef25d52bf7c7863 |
|
MD5 | 40cfb81bd1549804dd91541bdda1dc69 |
|
BLAKE2b-256 | b817a26d477b237654c32e1edc62e37a630192e2ca906be6b852a4cd66aa28c9 |
File details
Details for the file aiothrottle-0.1.3.win-amd64.zip
.
File metadata
- Download URL: aiothrottle-0.1.3.win-amd64.zip
- Upload date:
- Size: 11.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4993cb89a60e35389891e98e716c3086ecb5b882aadda71f6f30f7fbab9fbe38 |
|
MD5 | 6f9c99fb3ccbf6634e74664923aadd74 |
|
BLAKE2b-256 | d7e9ddb0c9af9a974b4349ed523dd70b058ee89b450e855f5dbcad080b829f00 |
File details
Details for the file aiothrottle-0.1.3-py3.5.egg
.
File metadata
- Download URL: aiothrottle-0.1.3-py3.5.egg
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfb1bbf1cbfda7047fe939e84d8db590212979b51cd58ac1fdbe980504d318ec |
|
MD5 | dee2bd40ca45622346ea624723349e7b |
|
BLAKE2b-256 | b02e4f61abdf3687a1582debdf17e103ea033f1413b8b3ec9a20b79f2b5eb9a6 |
File details
Details for the file aiothrottle-0.1.3-py3.4.egg
.
File metadata
- Download URL: aiothrottle-0.1.3-py3.4.egg
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd5cefdfa38b9a77b00881f0636c702dc2d28c9beba03f91a045f0ab29050def |
|
MD5 | 646073ac511a9551488378f9d2588e40 |
|
BLAKE2b-256 | 0d87a6690a6359a9b1fe61ec4fede02782b10b0a55285d35fa4c4ddbac244c9a |
File details
Details for the file aiothrottle-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: aiothrottle-0.1.3-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc59377504d5f86c03b177811146a0ede9ef797c3d9859c30f2ee6f563086268 |
|
MD5 | c41c52038613d4140236de982e6b63af |
|
BLAKE2b-256 | 5a0b6393f5916b1a89cf624ac1c914477d2028568b30527bfe6352417b172592 |