blob: a3ee09b36dbdc3079dd20354432fef83520a3cf3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
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>Low Clouds<th>ΔTemp<th>Depth<th>Wind<th>SWI</tr>"
for prediction in sorted(_storage.Storage(".waterspout/predictions.json"), key=lambda x: (x.time, x.swi)):
body += "<tr>"
body += f"<td>{prediction.time}"
body += f"<td>{prediction.low_clouds}"
body += f"<td>{prediction.temperature_difference}"
body += f"<td>{prediction.convective_cloud_depth}"
body += f"<td>{prediction.wind}"
body += f"<td>{prediction.swi}"
body += "</tr>"
body += "</table>"
return body
|