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_server(app.make_handler())
loop.run_until_complete(server)
Done. Not flask, but if you need to make lots of parallel network calls during a web request why the hell are you using flask?