Bandwidth throttling in Python(Python 中的带宽限制)
问题描述
有哪些库可以让您控制网络请求(尤其是 http)的下载速度.我没有看到 urllib2 中的任何内置内容(也没有在我打算使用的 (Py)Qt 中).
What libraries out there let you control the download speed of network requests (http in particular). I don't see anything built-in in urllib2 (nor in (Py)Qt which I intend on using).
Twisted 可以控制带宽吗?如果没有,如何控制 urllib2 或 Twisted 的读取缓冲区大小?sleep不能暂停网络操作.
Can Twisted control bandwidth? If not, how can I control the read buffer size of urllib2 or Twisted? sleeping to suspend network operations isn't an option.
推荐答案
当然twisted可以.你想要 twisted.protocols.policies.ThrottlingFactory代码>.只需将现有工厂包装在其中,然后再将其传递给任何想要的工厂.
Of course twisted can. You want twisted.protocols.policies.ThrottlingFactory. Just wrap your existing factory in it before you pass it to whatever wants a factory.
这篇关于Python 中的带宽限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Python 中的带宽限制
基础教程推荐
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
