It's clear for my how I use asyncio in python3.
import asyncio import time async def do_something(number): print(f"do something no.{number} at timestamp : {time.perf_counter():6.2f}") await asyncio.sleep(1) print(f"do something no.{number} ended at timestamp: {time.perf_counter():6.2f}") async def main(): await asyncio.gather( do_something(1), do_something(2) ) asyncio.run(main() ) However, I have no idea how I could create an own "await"-able object like asyncio.sleep. In this "await"-able I could encapsulate urllib.request, isn't it?
Can someone post an example? Many thanks.