async / await (Python)

Running many waiting tasks (network calls) at the same time in one program.

Also called: asyncio, await, coroutine

Domain
Languages
Source
General
Language
Python

In plain English

Useful when a script spends most of its time waiting for APIs. Normal CPU work doesn't get faster.

Example

With asyncio the scraper fetches twenty pages at the same time.

In code

import asyncio, httpx

async def main(urls):
    async with httpx.AsyncClient(timeout=15) as c:
        pages = await asyncio.gather(*(c.get(u) for u in urls))
asyncio.run(main(urls))

Related terms

Added 2026-11-30 · Last reviewed 2026-11-30