Python 中的带宽限制

Bandwidth throttling in Python(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 中的带宽限制