Skip to content

Instantly share code, notes, and snippets.

@code247
Last active October 21, 2017 21:15
Show Gist options
  • Save code247/99ed27f22acaf6493172b3365f508a4f to your computer and use it in GitHub Desktop.
Save code247/99ed27f22acaf6493172b3365f508a4f to your computer and use it in GitHub Desktop.
APScheduler example
from apscheduler.schedulers.blocking import BlockingScheduler
from helper import your_function_a, your_function_b
sched = BlockingScheduler()
@sched.scheduled_job('interval', minutes='30')
def print_data():
print("Have a good day!")
@sched.scheduled_job('cron', day_of_week='sat-sun', hour='8-14', minute='0-59/10', timezone='America/New_York')
def update_a():
your_function_a()
@sched.scheduled_job('cron', day_of_week='fri', hour='15-19/2', timezone='America/New_York')
def update_b():
your_function_b()
sched.start()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment