how to convert async function to sync function in python
from asgiref.sync import async_to_sync
async def func(args):
pass
async_to_sync(func)(args)
how to convert async function to sync function in python
from asgiref.sync import async_to_sync
async def func(args):
pass
async_to_sync(func)(args)
python async await
import asyncio
async def print_B(): #Simple async def
print("B")
async def main_def():
print("A")
await asyncio.gather(print_B())
print("C")
asyncio.run(main_def())
# The function you wait for must include async
# The function you use await must include async
# The function you use await must run by asyncio.run(THE_FUNC())
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us