From 4cf0e2fac2e3f33e45b66da0caf2c8e1a70e2e59 Mon Sep 17 00:00:00 2001 From: crunk Date: Mon, 2 Oct 2023 21:09:50 +0200 Subject: [PATCH] brain off, produce boilerplate --- app.py | 19 ++++++++++++++++--- static/atom.xml | 2 ++ static/rss.xml | 2 ++ 3 files changed, 20 insertions(+), 3 deletions(-) create mode 100644 static/atom.xml create mode 100644 static/rss.xml diff --git a/app.py b/app.py index a8eee11..1106241 100644 --- a/app.py +++ b/app.py @@ -20,9 +20,11 @@ def create_app(): db.init_app(APP) migrate.init_app(APP, db, render_as_batch=True) + create_rss_feed() + @scheduler.task("interval", id="update", minutes=10) def update(): - create_rss_feed() + update_rss_feed() return APP @@ -30,7 +32,18 @@ def create_app(): def create_rss_feed(): print("creating rss feed") fg = FeedGenerator() + fg.id("http://crunk.website") + fg.title("Crunk website") + fg.author({"name": "John Doe", "email": "john@example.de"}) + fg.link(href="http://crunk.website", rel="alternate") + fg.subtitle("Some things crunk is doing!") + fg.link(href="http://crunk.website/test.atom", rel="self") + fg.language("en") atomfeed = fg.atom_str(pretty=True) rssfeed = fg.rss_str(pretty=True) - fg.atom_file("atom.xml") - fg.rss_file("rss.xml") + fg.atom_file("static/atom.xml") + fg.rss_file("static/rss.xml") + + +def update_rss_feed(): + print("updating rss feed") diff --git a/static/atom.xml b/static/atom.xml new file mode 100644 index 0000000..1c0ee52 --- /dev/null +++ b/static/atom.xml @@ -0,0 +1,2 @@ + +http://crunk.websiteCrunk website2023-10-02T19:08:59.272412+00:00John Doejohn@example.depython-feedgenSome things crunk is doing! \ No newline at end of file diff --git a/static/rss.xml b/static/rss.xml new file mode 100644 index 0000000..bf5e2f9 --- /dev/null +++ b/static/rss.xml @@ -0,0 +1,2 @@ + +Crunk websitehttp://crunk.website/test.atomSome things crunk is doing!http://www.rssboard.org/rss-specificationpython-feedgenenMon, 02 Oct 2023 19:08:59 +0000 \ No newline at end of file