webapi where you can request scheduled rss feed publishing
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.

34 lines
629 B

import flask_apscheduler
from flask import request
from app import create_app
from scheduler.schedule_text import schedule_post
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():
return schedule_post(request)
if __name__ == "__main__":
APP.run()