diff --git a/i3pystatus/weather/wunderground.py b/i3pystatus/weather/wunderground.py index f2d40b9..7b1f7b2 100644 --- a/i3pystatus/weather/wunderground.py +++ b/i3pystatus/weather/wunderground.py @@ -239,10 +239,13 @@ class Wunderground(WeatherBackend): return str(data.get(key, default)) try: - observation_time = datetime.fromtimestamp( - int(_find('observation_epoch')) + observation_epoch = _find('observation_epoch') or _find('local_epoch') + observation_time = datetime.fromtimestamp(int(observation_epoch)) + except (TypeError, ValueError): + log.debug( + 'Observation time \'%s\' is not a UNIX timestamp', + observation_epoch ) - except TypeError: observation_time = datetime.fromtimestamp(0) self.data['city'] = _find('city', response['observation_location'])