Return 404 on missing timeseries

This commit is contained in:
Peter J. Holzer 2022-09-04 21:03:17 +02:00
parent f8d0e84097
commit b2c874b4a6
1 changed files with 4 additions and 1 deletions

5
app.py
View File

@ -38,7 +38,10 @@ def report():
@app.route("/ts/<id>") @app.route("/ts/<id>")
def get_timeseries(id): def get_timeseries(id):
ts = LTS(id=id) try:
ts = LTS(id=id)
except FileNotFoundError:
abort(404)
return jsonify({"description": ts.description, "data": ts.data}) return jsonify({"description": ts.description, "data": ts.data})
def verify_node(d): def verify_node(d):