Quantcast
Channel: How can I call an async function without await? - Stack Overflow
Browsing all 7 articles
Browse latest View live

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 Article


Answer 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 Article


Answer 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 Article

Answer 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 Article

Answer 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 Article


Answer 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 Article

How 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
Browsing all 7 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>