Member-only story
Introduction to APScheduler
In-process task scheduler with Cron-like capabilities

This tutorial focuses on how to perform task scheduling via a popular Python library called APScheduler. From the official documentation:
Advanced Python Scheduler (APScheduler) is a Python library that lets you schedule your Python code to be executed later, either just once or periodically. You can add new jobs or remove old ones on the fly as you please. If you store your jobs in a database, they will also survive scheduler restarts and maintain their state. When the scheduler is restarted, it will then run all the jobs it should have run while it was offline.
One of the main advantages of APScheduler is it can be used across different platforms or act as a replacement to the cron daemon or Windows Task Scheduler. Besides, it’s also in active development at the time of this writing.
APScheduler offers three basic scheduling systems:
- Cron-style scheduling (with optional start/end times)
- Interval-based execution (runs jobs on even intervals, with optional start/end times)
- One-off delayed execution (runs jobs once, on a set date/time)
We’ll attempt to create a simple task scheduler job in a Flask server. This tutorial is…