Skip to content

Commit

Permalink
Add meta feed
Browse files Browse the repository at this point in the history
  • Loading branch information
frcroth committed Sep 18, 2023
1 parent 272b877 commit 0bed929
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion om-bistro/openmensa_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import datetime

from flask import Flask, make_response
from flask import Flask, make_response, Response

from pdf_downloader import download_pdf
from pdf_parser import parse_pdf
Expand All @@ -9,6 +9,7 @@

last_download = datetime.date.fromtimestamp(0)


@app.route("/feed")
def feed():
global last_download
Expand All @@ -19,6 +20,27 @@ def feed():
return parse_pdf()


@app.route("/meta")
def meta():
xml = """
<openmensa version="2.1"
xmlns="http://openmensa.org/open-mensa-v2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://openmensa.org/open-mensa-v2 http://openmensa.org/open-mensa-v2.xsd">
<canteen>
<name>Schraders Bistro</name>
<address>August-Bebel-Straße 26–53 14482 Potsdam</address>
<availability>public</availability>
<feed name="full">
<url>https://openmensa.scm.io/feed</url>
<schedule dayOfMonth="*" dayOfWeek="1" hour="8"/>
</feed>
</canteen>
</openmensa>
"""
return Response(xml, mimetype="text/xml")


@app.route("/health_check")
def health_check():
return make_response("OK", 200)

0 comments on commit 0bed929

Please sign in to comment.