aiohttp计划在后台运行任务

2024-09-30 06:23:43 发布

您现在位置:Python中文网/ 问答频道 /正文

例如:

async def first_route(request):
    ......

async def second_route(request):
    ......
    
async def functionToSchedule():
    ......
    
if __name__ == '__main__':

    app = web.Application()
    app.router.add_get('/fr', first_route)
    app.router.add_post('/sr', second_route)
    web.run_app(app)

我无法理解,我如何才能添加任务以每天在00:00运行functionToSchedule。 如果我使用简单的schedule库,我不能在web.run_app(app)之后粘贴函数调用


Tags: runnameaddwebappasyncifmain

热门问题