多个并发URL调用 [英] several concurrent URL calls

查看:95
本文介绍了多个并发URL调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何并行执行 N 个url调用,并在返回时处理响应?



<我想准备响应并将它们打印到屏幕上,也许经过一些操作。
我不在乎响应的顺序。

解决方案

您可以为此使用Twisted Python如此处的示例所示: https://twistedmatrix.com/documents /13.0.0/web/howto/client.html#auto3



Twisted是适用于Python的异步编程库,可让您在同时,,它带有一个HTTP客户端(和服务器)。


How can I make, say N url calls in parallel, and process the responses as they come back?

I want to ready the responses and print them to the screen, maybe after some manipulations. I don't care about the order of the responses.

解决方案

You can use Twisted Python for this, such as in the example here: https://twistedmatrix.com/documents/13.0.0/web/howto/client.html#auto3

Twisted is an asynchronous programming library for Python which lets you carry out multiple actions "at the same time," and it comes with an HTTP client (and server).

这篇关于多个并发URL调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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