diff options
Diffstat (limited to 'waterspout_radar')
-rw-r--r-- | waterspout_radar/web.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/waterspout_radar/web.py b/waterspout_radar/web.py new file mode 100644 index 0000000..67ac4ca --- /dev/null +++ b/waterspout_radar/web.py @@ -0,0 +1,17 @@ +import flask + +from . import _storage + +app = flask.Flask(__name__) + + +@app.route("/") +def predictions(): + body = "<!doctype html><html lang='en'><meta charset='utf-8'><title>Predictions</title>" + body += "<h1>Prediction</h1><hr>" + body += "<table>" + body += "<tr><th>Time<th>ΔTemp<th>Depth<th>SWI</tr>" + for prediction in sorted(_storage.Storage(".waterspout/predictions.json"), key=lambda x: (x.time, x.swi)): + body += f"<tr><td>{prediction.time}<td>{prediction.temperature_difference}<td>{prediction.convective_cloud_depth}<td>{prediction.swi}</tr>" + body += "</table>" + return body |