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.
This commit is contained in:
Hemna 2021-01-22 16:32:49 -05:00
parent 51894bbab8
commit 0d18e54969
1 changed files with 4 additions and 0 deletions

View File

@ -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"],