how to parse response immediately with asyncio.gather?

async def main(): uuids = await get_uuids_from_text_file() tasks = [] # create a task for each uuid # and add it to the list of tasks for uuid in uuids: task = asyncio.create_task(make_hypixel_request(uuid)) tasks.append(task) # wait for all the tasks to finish responses = await asyncio.gather(*tasks) # run the functions to process the data for … Read more

Making an asynchronous task in Flask

I am writing an application in Flask, which works really well except that WSGI is synchronous and blocking. I have one task in particular which calls out to a third party API and that task can take several minutes to complete. I would like to make that call (it’s actually a series of calls) and let it run. while control is returned to Flask.

Asyncio.gather vs asyncio.wait

asyncio.gather and asyncio.wait seem to have similar uses: I have a bunch of async things that I want to execute/wait for (not necessarily waiting for one to finish before the next one starts). They use a different syntax, and differ in some details, but it seems very un-pythonic to me to have 2 functions that have such a huge overlap in functionality. What am I missing?