用于AIOHTTP的节流、流量控制流读取器
aiothrottle的Python项目详细描述
所有转子
用于aiohttp的节流、流量控制流读取器
要求
- python=3.4.2
- aiohttphttps://pypi.python.org/pypi/aiohttp
许可证
aiothrottle在GPLv3许可下提供。
源代码
github存储库中提供了最新的开发人员版本: https://github.com/panda73111/aiothrottle
使用量
importasyncioimportaiohttpimportaiothrottle@asyncio.coroutinedefload_file(url):response=yield fromaiohttp.request("GET",url)data=yield fromresponse.read()withopen("largefile.zip","wb")asfile:file.write(data)response.close()# setup the rate limit to 200 KB/saiothrottle.limit_rate(200*1024)# download a large file without blocking bandwidthloop=asyncio.get_event_loop()loop.run_until_complete(load_file("http://example.com/largefile.zip"))# unset the rate limitaiothrottle.unlimit_rate()
待办事项
- 上传速率限制类
- 通用套接字限制类
更改
0.1.3(2016年8月30日)
- 将所需的最低python版本设置为3.4.2,与aiohttp 1.0.0相同
- 使aiothrottle再次与当前aiohttp版本兼容 (现在使用aiohttp.streamreader.\u缓冲区大小)
- 尝试暂停关闭SSLProtocolTransport时捕获运行时错误
0.1.2(2015年8月8日)
- 修复了经常恢复传输的问题
- 添加了“速率限制”和“限制”属性
- 固定缓冲区限制控制
0.1.1(2015年2月8日)
- 在全局和响应方面添加了limit_rate()和unlimit_rate()
- 提高无效速率限制的值时出错
- 取消节气门析构函数中的检查手柄
0.1.0(2015年1月8日)
- 具有基本节流功能的初始版本