Gigino
Gigino

Reputation: 355

How to import APScheduler?

Reading the answer in this link https://stackoverflow.com/a/53938833/4187237, I don't get how to import the class

   APScheduler()

Does enyone have any idea on how to do it? I'm looking for somthing like

   from apscheduler import APScheduler

Upvotes: 0

Views: 789

Answers (1)

Lucan
Lucan

Reputation: 3585

I'm not aware of APScheduler as a scheduler type, you can see the list of valid schedulers in the documentation. That answer is a few years old and using APScheduler 3.5.3 whereas the latest stable version is 3.6.3.

Using a BlockingScheduler as an example, you can achieve the desired effect:

from apscheduler.schedulers.blocking import BlockingScheduler

scheduler = BlockingScheduler()

@scheduler.scheduled_job('interval', id="my_job_id", seconds=5)
def test():
    print("Working")

scheduler.start()

Upvotes: 1

Related Questions