import asyncio
from aiohttp import web
import time

async def process():

    for i in range(10):
        print("process data !!")
        # time.sleep(1)
        await asyncio.sleep(1)


async def hello(request):

    job = process()
    asyncio.create_task(job)
    return web.Response(text='Hello Aiohttp!')


app = web.Application()
app.router.add_get("/hello",hello)
web.run_app(app, host="0.0.0.0", port=9000)

  

相关文章:

  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-31
  • 2021-10-24
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
相关资源
相似解决方案