Answer by 0xZ3RR0 for How can I call an async function without await?
Since Python 3.7 this can be easily achieved via asyncio.create_task.import asyncio# replace with handler_message or whichever function you want to callasyncio.create_task(YOUR_ASYNC_FUNCTION(ARG1,...
View ArticleAnswer by Shubham Yadav05 for How can I call an async function without await?
Problem Statement: I Was Using FastApi on Azure Function App and i was also using Beanie ODM for MongoDB and Beanie is an asynchronous ODM so it need to initialized at the startup event but as azure...
View ArticleAnswer by david euler for How can I call an async function without await?
You can call it by multiprocessing pool.from multiprocessing import Poolimport timedef f(x): return x*xdef postprocess(result): print("finished: %s" % result)if __name__ == '__main__': pool =...
View ArticleAnswer by user3761555 for How can I call an async function without await?
In simplest form:import asynciofrom datetime import datetimedef _log(msg : str): print(f"{datetime.utcnow()} {msg}")async def dummy(name, delay_sec): _log(f"{name} entering ...") await...
View ArticleAnswer by Pasalino for How can I call an async function without await?
Other way would be to use ensure_future function:import asyncioasync def handler_message(request):...loop = asyncio.get_event_loop()loop.ensure_future(perform_message(x,y,z))...
View ArticleAnswer by freakish for How can I call an async function without await?
One way would be to use create_task function:import asyncioasync def handler_message(request): ... loop = asyncio.get_event_loop() loop.create_task(perform_message(x,y,z)) ...As per the loop...
View ArticleHow can I call an async function without await?
I have a controller action in aiohttp application.async def handler_message(request): try: content = await request.json() perform_message(x,y,z) except (RuntimeError): print("error in perform fb...
View Article