You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
641 B
33 lines
641 B
import flask_apscheduler
|
|
from flask import Flask, request
|
|
|
|
from app import create_app
|
|
from scheduler.schedule_text import schedule_text
|
|
from updater import update_rss_feed
|
|
|
|
APP = create_app()
|
|
|
|
scheduler = flask_apscheduler.APScheduler()
|
|
scheduler.api_enabled = False
|
|
scheduler.init_app(APP)
|
|
scheduler.start()
|
|
|
|
|
|
@scheduler.task("interval", id="update", minutes=1)
|
|
def update():
|
|
with APP.app_context():
|
|
update_rss_feed()
|
|
|
|
|
|
@APP.route("/")
|
|
def index():
|
|
return "crunk-scheduler online!"
|
|
|
|
|
|
@APP.route("/schedule", methods=["POST"])
|
|
def schedule_post():
|
|
return schedule_text(request)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
APP.run()
|
|
|