R
R
Robotex2013-05-24 11:43:10
Python
Robotex, 2013-05-24 11:43:10

Is it possible in Python to make a function wait for multiple asynchronous requests to complete?

There is a function in a Python application that makes four get requests, then assigns their responses to variables, and then processes those variables. It happens synchronously. Is it possible to have these four requests processed at the same time asynchronously, and then put the function on "pause" until they all return a result? Those. actually write synchronously asynchronous code.
Application on the Tornado framework

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
yurtaev, 2013-05-24
@yurtaev

No threading or multiprocessing. Need tornado.gen.WaitAll
www.tornadoweb.org/en/stable/gen.html
www.tornadoweb.org/en/stable/gen.html#tornado.gen.Wait

A
Arkady, 2013-05-24
@p0is0n

I didn't use Tornado, but in twisted it can be obtained using the inlineCallbacks decorator. Might come in as a hint.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question