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 dad1388
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 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,29 @@ 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>
<coordinates lat="52.387832" lng="13.121451"/>
<availability>public</availability>
<city>Potsdam</city>
<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 dad1388

Please sign in to comment.