summaryrefslogtreecommitdiff
path: root/waterspout_radar
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2023-04-03 23:15:09 +0200
committerAki <please@ignore.pl>2023-04-03 23:15:09 +0200
commit9451fa019cb084db820f3255b0da2cc863d0f990 (patch)
treee5f43c86e8ec758b7eef0d4e50a0208f74289fb1 /waterspout_radar
parent563ef8786f395ce1abe903f3341bf3a361410b7b (diff)
downloadwaterspout-radar-9451fa019cb084db820f3255b0da2cc863d0f990.zip
waterspout-radar-9451fa019cb084db820f3255b0da2cc863d0f990.tar.gz
waterspout-radar-9451fa019cb084db820f3255b0da2cc863d0f990.tar.bz2
Implemented naive web view
Diffstat (limited to 'waterspout_radar')
-rw-r--r--waterspout_radar/web.py17
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>&Delta;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