Python:如何在一段时间内进行多个HTTP POST查询? [英] Python: How to make multiple HTTP POST queries in one moment?

查看:329
本文介绍了Python:如何在一段时间内进行多个HTTP POST查询?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用Python在一段时间内进行多个HTTP POST查询?

How to make multiple HTTP POST queries in one moment using Python?

使用带有示例的外部库可能是一个很好的解决方案。

Using an external library with an example can be a good solution.

推荐答案

外部库?也许内部人会做的...

External lib? Maybe an internal one would do the trick...

http://docs.python.org/library/httplib.html#examples

专门:

params = urllib.urlencode({'spam': 1, 'eggs': 2, 'bacon': 0})

如果你想处理多个HTTP POST查询(异步),你可以循环遍历它们,使用 subprocess.Popen 。虽然更好的解决方案可能是 asyncore 此网站有一个 example 为http请求(如POST)使用异步。

If you wanted to process multiple HTTP POST queries (asynchronous) you could cycle through them in a loop, opening subprocesses using subprocess.Popen. Although a better solution would probably be asyncore. This site has an example of using asyncore for http requests (like POST).

这篇关于Python:如何在一段时间内进行多个HTTP POST查询?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆