Browse Source

brain off, produce boilerplate

main
crunk 1 year ago
parent
commit
4cf0e2fac2
  1. 19
      app.py
  2. 2
      static/atom.xml
  3. 2
      static/rss.xml

19
app.py

@ -20,9 +20,11 @@ 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)
create_rss_feed()
@scheduler.task("interval", id="update", minutes=10) @scheduler.task("interval", id="update", minutes=10)
def update(): def update():
create_rss_feed() update_rss_feed()
return APP return APP
@ -30,7 +32,18 @@ def create_app():
def create_rss_feed(): def create_rss_feed():
print("creating rss feed") print("creating rss feed")
fg = FeedGenerator() 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) atomfeed = fg.atom_str(pretty=True)
rssfeed = fg.rss_str(pretty=True) rssfeed = fg.rss_str(pretty=True)
fg.atom_file("atom.xml") fg.atom_file("static/atom.xml")
fg.rss_file("rss.xml") fg.rss_file("static/rss.xml")
def update_rss_feed():
print("updating rss feed")

2
static/atom.xml

@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><id>http://crunk.website</id><title>Crunk website</title><updated>2023-10-02T19:08:59.272412+00:00</updated><author><name>John Doe</name><email>john@example.de</email></author><link href="http://crunk.website" rel="alternate"/><link href="http://crunk.website/test.atom" rel="self"/><generator uri="https://lkiesow.github.io/python-feedgen" version="0.9.0">python-feedgen</generator><subtitle>Some things crunk is doing!</subtitle></feed>

2
static/rss.xml

@ -0,0 +1,2 @@
<?xml version='1.0' encoding='UTF-8'?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" version="2.0"><channel><title>Crunk website</title><link>http://crunk.website/test.atom</link><description>Some things crunk is doing!</description><atom:link href="http://crunk.website/test.atom" rel="self"/><docs>http://www.rssboard.org/rss-specification</docs><generator>python-feedgen</generator><language>en</language><lastBuildDate>Mon, 02 Oct 2023 19:08:59 +0000</lastBuildDate></channel></rss>
Loading…
Cancel
Save