Open this example in the interactive library
Source code
import asyncio
async def main():
try:
async with asyncio.timeout(0):
await asyncio.sleep(1)
except TimeoutError:
print('Timed out')
asyncio.run(main())Sample output
Timed out
