From 9683e93cd4325043546d45f74e4793d153eee931 Mon Sep 17 00:00:00 2001 From: Rien Maertens Date: Tue, 19 Feb 2019 12:31:00 +0100 Subject: [PATCH] Split /resto in json and plain version --- app/app.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/app.py b/app/app.py index 42d3726..1dd5f64 100644 --- a/app/app.py +++ b/app/app.py @@ -191,7 +191,7 @@ def resto_menu(): resto = requests.get(url).json() if not resto["open"]: - return mattermost_response('De resto is vandaag gesloten.', ephemeral=True) + return 'De resto is vandaag gesloten.' else: def table_for(kind): items = [meal for meal in resto["meals"] if meal["kind"] == kind] @@ -222,15 +222,16 @@ def resto_menu(): {vegetable_table} """ - return mattermost_response(template.format( + return template.format( soup_table=table_for("soup"), meat_table=table_for("meat"), fish_table=table_for("fish"), vegi_table=table_for("vegetarian"), vegetable_table="\n".join(resto["vegetables"]) - ), ephemeral = True) - - - + ) + +@app.route('/resto.json', methods=['GET']) +def resto_menu_json(): + return mattermost_response(resto_menu(), ephemeral=True)