Python中的带宽限制 [英] Bandwidth throttling in 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).
可以扭曲控制带宽吗?如果没有,如何控制urllib2或Twisted的读取缓冲区大小? sleep
暂停网络操作不是一种选择.
Can Twisted control bandwidth? If not, how can I control the read buffer size of urllib2 or Twisted? sleep
ing to suspend network operations isn't an option.
推荐答案
当然可以扭曲.您需要 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中的带宽限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!