From 0d18e54969d79842666a79a9f7f5b7ae895fa02e Mon Sep 17 00:00:00 2001 From: Hemna Date: Fri, 22 Jan 2021 16:32:49 -0500 Subject: [PATCH] Fixed an issue with LocationPlugin When calling LocationPlugin with a callsign outside of the US, the forecast.weather gov wasn't raising an exception. A valid json dict was coming back, but it didn't have location data we were expecting. --- aprsd/plugins/location.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/aprsd/plugins/location.py b/aprsd/plugins/location.py index fd667ef..50a6de2 100644 --- a/aprsd/plugins/location.py +++ b/aprsd/plugins/location.py @@ -65,6 +65,10 @@ class LocationPlugin(plugin.APRSDPluginBase): LOG.error("Couldn't fetch forecast.weather.gov '{}'".format(ex)) wx_data = {"location": {"areaDescription": "Unknown Location"}} + if "location" not in wx_data: + LOG.error("Couldn't fetch forecast.weather.gov '{}'".format(wx_data)) + wx_data = {"location": {"areaDescription": "Unknown Location"}} + reply = "{}: {} {}' {},{} {}h ago".format( searchcall, wx_data["location"]["areaDescription"],