I'm having a small web server that that i'm trying to run async functions on web request:
from aiohttp import web
import asyncio
async def funcB():
while True:
print("running")
async def funcA(req):
print('start')
asyncio.Task(funcB())
print('execute task completed')
return web.Response(text="OK Start");
if __name__ == '__main__':
app = web.Application()
app.add_routes([web.get('/', funcA)])
web.run_app(app, host='127.0.0.1', port=2000)
Once running the app and triggering it by curl http://127.0.0.1:2000/
i do get the execute task completed
logline, but the curl response of the curl is not been received, if I comment out the asyncio.Task(funcB())
line - I do get the response of the CURL command - I must say that funcB dose run..
what do I miss here?