Answers for "await async function from non async python"

1

await async function from non async python

import asyncio

async def async_func():
  await asyncio.sleep(1) # <- replace this with your async code

loop = asyncio.get_event_loop()
coroutine = async_func()
loop.run_until_complete(coroutine)
Posted by: Guest on February-22-2022

Python Answers by Framework

Browse Popular Code Answers by Language