NuWeather: fix crash with DarkSky when forecast summary is unavailable

This commit is contained in:
James Lu 2020-05-25 13:56:19 -07:00
parent 38e31daf3e
commit fcef45ae77

View File

@ -490,7 +490,7 @@ class NuWeather(callbacks.Plugin):
'forecast': [{'dayname': self._get_dayname(forecastdata['time'], idx, tz=data['timezone']), 'forecast': [{'dayname': self._get_dayname(forecastdata['time'], idx, tz=data['timezone']),
'max': self._format_temp(f=forecastdata.get('temperatureHigh')), 'max': self._format_temp(f=forecastdata.get('temperatureHigh')),
'min': self._format_temp(f=forecastdata.get('temperatureLow')), 'min': self._format_temp(f=forecastdata.get('temperatureLow')),
'summary': forecastdata['summary'].rstrip('.')} for idx, forecastdata in enumerate(data['daily']['data'])] 'summary': forecastdata.get('summary', 'N/A').rstrip('.')} for idx, forecastdata in enumerate(data['daily']['data'])]
} }
def _openweathermap_fetcher(self, location, geobackend=None): def _openweathermap_fetcher(self, location, geobackend=None):