The one problem I have with Python and would like to solve, is to be able, from within a request rendering function/method of my web application (think Flask) to run something like: handle1 = call_webservice_1(args) handle2 = call_webservice_2(args) handle3 = call_webservice_3(args) (realres1, realres2, realres3) = wait_until_timeout(500, handle1, handle2, handle3) # here, I have my results in realresX or None if tim…
from asyncio import wait, gather, get_event_loop from aiohttp import web async my_handler(request): handle1 = call_webservice_1(args) handle2 = call_webservice_2(args) handle3 = call_webservice_3(args) await wait(gather(handle1, handle2, handle3), 500) return web.Response({'finished': True}) app = web.Application() app.router.add_route('GET', '/test/', my_handler) loop = asyncio.get_event_loop() server = loop.create_…
If the answer is "to get some async goodness, just use this easy code, plus rewrite your entire project to use a different framework and set of libraries", then we are only fooling ourselves.