asyncio.
get_event_loop
()Возвращает цикл обработчика событий
loop = get_event_loop()
coroutines = [async_get(url) for _ in range(8)]
results = loop.run_until_complete(asyncio.gather(*coroutines))
asyncio.
loop
Объект цикла, возвращаемого get_event_loop()
run_until_complete
()async def task():
print('hello world')
async def task2():
print('hello world')
loop.run_until_complete(task())
loop.run_until_complete(asyncio.gather(task(), task2()))
asyncio.
sleep
()Асинхронный метод ожидания
async def runner():
while True:
before()
asyncio.sleep(1)
after()