from flask import Flask
from flask_apscheduler import APScheduler

# set configuration values
class Config:
    SCHEDULER_API_ENABLED = True

# create app
app = Flask(__name__)
app.config.from_object(Config())

# initialize scheduler
scheduler = APScheduler()
# if you don't wanna use a config, you can set options here:
# scheduler.api_enabled = True
scheduler.init_app(app)


# interval example
@scheduler.task('interval', id='do_job_1', seconds=3, misfire_grace_time=900)
def job1():
    print('Job 1 executed')


# cron examples
@scheduler.task('interval', id='do_job_2', seconds=5)
def job2():
    print('Job 2 executed')



scheduler.start()


if __name__ == '__main__':
    app.run()
