H
H
Hypick2021-10-06 00:27:16
Python
Hypick, 2021-10-06 00:27:16

How to run a function every day at a certain time using APScheduler?

How to run a function every day at 3:00 using APScheduler?
I only know how to make an interval:

from threading import Thread
from apscheduler.schedulers.asyncio import AsyncIOScheduler

async def test():
    #code

def run():
    scheduler = AsyncIOScheduler()
    scheduler.add_job(test, 'interval', seconds=3)
    scheduler.start()

thread = Thread(target=run())
thread.start()

#code

Answer the question

In order to leave comments, you need to log in

2 answer(s)
H
Hypick, 2021-10-06
@Hypick

already made it myself

from threading import Thread
from apscheduler.schedulers.asyncio import AsyncIOScheduler

async def test():
    #code

def run():
    scheduler = AsyncIOScheduler()
    scheduler.add_job(test, 'cron', hour=3, minute=0)
    scheduler.start()

thread = Thread(target=run())
thread.start()

#code

A
alternativshik, 2021-10-06
@alternativshik

It's all in the Documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question