From 9dcc90c66624ba709e7ed69d393b554a0ed6fb30 Mon Sep 17 00:00:00 2001 From: blakadder Date: Mon, 8 Nov 2021 10:31:37 +0100 Subject: [PATCH] remove hourly from weather for JSON j2 format #661 related Pardon my Python, I'm still a novice. This is basically what I was thinking, strip out the hourly data completely and leave the rest. --- lib/view/line.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/view/line.py b/lib/view/line.py index 525614d..2a31b70 100644 --- a/lib/view/line.py +++ b/lib/view/line.py @@ -360,9 +360,10 @@ def format_weather_data(query, parsed_query, data): format_line = PRECONFIGURED_FORMAT[format_line] if format_line in ["j1", "j2"]: - # j2 is a lightweight j1, without 'weather' (weather forecast) + # j2 is a lightweight j1, without 'hourly' in 'weather' (weather forecast) if "weather" in data["data"] and format_line == "j2": - del data["data"]["weather"] + for i in range(len(data["data"]["weather"])): + del data["data"]["weather"][i]["hourly"] return render_json(data['data']) if format_line == "p1": return prometheus.render_prometheus(data['data'])