From a0707ad725b57cffd9e6fe3be36b7b333d9ede4d Mon Sep 17 00:00:00 2001 From: wayne-shih <0x26@wayneshih.com> Date: Wed, 26 Nov 2025 22:58:55 +1300 Subject: [PATCH 1/2] fix(detailedmetar,rawmetar): update api --- apps/detailedmetar/detailedmetar.star | 2 +- apps/rawmetar/raw_metar.star | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/detailedmetar/detailedmetar.star b/apps/detailedmetar/detailedmetar.star index 360995e87a..c9b22c07ec 100644 --- a/apps/detailedmetar/detailedmetar.star +++ b/apps/detailedmetar/detailedmetar.star @@ -22,7 +22,7 @@ def main(config): f_selector = config.bool("fahrenheit_temperatures", False) # API URL - apiURL = "https://www.aviationweather.gov/cgi-bin/data/metar.php?ids=" + airport + "&format=json" + apiURL = "https://aviationweather.gov/api/data/metar?ids=" + airport + "&format=json" # Store cahces by airport. That way if two users are pulling the same airport's METAR it is only fetched once. cacheName = "metar/" + airport diff --git a/apps/rawmetar/raw_metar.star b/apps/rawmetar/raw_metar.star index ad86beb507..ed98c86db9 100644 --- a/apps/rawmetar/raw_metar.star +++ b/apps/rawmetar/raw_metar.star @@ -22,7 +22,7 @@ def main(config): ), ) - response = http.get("https://www.aviationweather.gov/cgi-bin/data/metar.php?ids={}".format(station_id)) + response = http.get("https://aviationweather.gov/api/data/metar?ids={}".format(station_id)) content = response.body() if not content: From ca8b0eb4aadd86ee80cd1463bd1f678fcf33ea8d Mon Sep 17 00:00:00 2001 From: wayne-shih <0x26@wayneshih.com> Date: Wed, 26 Nov 2025 23:16:49 +1300 Subject: [PATCH 2/2] fix(detailedmetar): allow for no wgst in json --- apps/detailedmetar/detailedmetar.star | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/detailedmetar/detailedmetar.star b/apps/detailedmetar/detailedmetar.star index c9b22c07ec..a18ef7cef1 100644 --- a/apps/detailedmetar/detailedmetar.star +++ b/apps/detailedmetar/detailedmetar.star @@ -482,8 +482,9 @@ def getWindSpeed(decodedMetar): windSpeedText = "Calm" # Set wind gust variable - if decodedMetar["wgst"] != None: - windGust = int(decodedMetar["wgst"]) + windGust = decodedMetar.get("wgst") + if windGust != None: + windGust = int(windGust) windSpeedText = str(windSpeed) + "-" + str(windGust) + "kts" # Wind speed color determinations