Throttling, flow controlling StreamReader for aiohttp
Project description
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 functools
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
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.1.post0.zip
.
File metadata
- Download URL: aiothrottle-0.1.1.post0.zip
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1556f1cafc576fd106e12ec21e5f1470ad3eca5b5d840dccbbe2366d85a8cbbb |
|
MD5 | 974a5513edca3efb9afcb74a73b7fb5a |
|
BLAKE2b-256 | 027fffd88aa2e24cabb80eddbe643163c380cf851596a95522c3c0be9ab6f1c0 |
File details
Details for the file aiothrottle-0.1.1.post0-py3.4.egg
.
File metadata
- Download URL: aiothrottle-0.1.1.post0-py3.4.egg
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 725d0e8039af86b52b20daf14a742cea37a0a172631e881b0746b5c6d1b727a7 |
|
MD5 | efc919dd04907dca9218beb543e48063 |
|
BLAKE2b-256 | e831698cc09669bf2ebe4b308d0ea895176fc8e425f658f87f8c646ad6c9e9e6 |
File details
Details for the file aiothrottle-0.1.1.post0-py3-none-any.whl
.
File metadata
- Download URL: aiothrottle-0.1.1.post0-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89556ea61edac8e24a46165f699768683edfa30006e83387dee359eff2d097b9 |
|
MD5 | b9c03cb41bc49b78e63f4330c949c3d4 |
|
BLAKE2b-256 | 66edbf8d119f9db39745227cf685d4383b46d7937bfe4b6a7cb8229f807800a6 |