wip rss feed generator code

This commit is contained in:
crunk 2023-10-02 20:59:47 +02:00
parent 396e41dd8c
commit 04c15f0628
3 changed files with 18 additions and 0 deletions

14
app.py
View File

@ -1,4 +1,5 @@
import flask_apscheduler import flask_apscheduler
from feedgen.feed import FeedGenerator
from flask import Flask from flask import Flask
from flask_migrate import Migrate from flask_migrate import Migrate
from flask_sqlalchemy import SQLAlchemy from flask_sqlalchemy import SQLAlchemy
@ -19,4 +20,17 @@ def create_app():
db.init_app(APP) db.init_app(APP)
migrate.init_app(APP, db, render_as_batch=True) migrate.init_app(APP, db, render_as_batch=True)
@scheduler.task("interval", id="update", minutes=10)
def update():
create_rss_feed()
return APP return APP
def create_rss_feed():
print("creating rss feed")
fg = FeedGenerator()
atomfeed = fg.atom_str(pretty=True)
rssfeed = fg.rss_str(pretty=True)
fg.atom_file("atom.xml")
fg.rss_file("rss.xml")

Binary file not shown.

View File

@ -3,6 +3,7 @@ APScheduler==3.10.1
black==23.7.0 black==23.7.0
blinker==1.6.2 blinker==1.6.2
click==8.1.5 click==8.1.5
feedgen==0.9.0
feedgenerator==2.1.0 feedgenerator==2.1.0
Flask==2.3.2 Flask==2.3.2
Flask-APScheduler==1.12.4 Flask-APScheduler==1.12.4
@ -13,12 +14,15 @@ greenlet==2.0.2
isort==5.12.0 isort==5.12.0
itsdangerous==2.1.2 itsdangerous==2.1.2
Jinja2==3.1.2 Jinja2==3.1.2
lxml==4.9.3
Mako==1.2.4 Mako==1.2.4
MarkupSafe==2.1.3 MarkupSafe==2.1.3
msgpack==1.0.7
mypy-extensions==1.0.0 mypy-extensions==1.0.0
packaging==23.1 packaging==23.1
pathspec==0.11.1 pathspec==0.11.1
platformdirs==3.9.1 platformdirs==3.9.1
pynvim==0.4.3
python-dateutil==2.8.2 python-dateutil==2.8.2
pytz==2023.3 pytz==2023.3
six==1.16.0 six==1.16.0