Skip to content

Commit

Permalink
Merge pull request #6 from kipe/bugfix
Browse files Browse the repository at this point in the history
Add exception handling to weather symbol conversion.
  • Loading branch information
kipe authored Dec 21, 2020
2 parents da6194c + 87004aa commit 293e462
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion fmi/observation.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def __init__(self, timestamp, point):
self.dew_point = point.get('dew_point', None)
self.precipitation = point.get('precipitation', None)
self.precipitation_1h = point.get('precipitation_1h', None)
self.weather_symbol = int(point.get('weather_symbol', 0))
self.radiation_global_accumulation = point.get(
'radiation_global_accumulation', None)
self.radiation_long_wave_accumulation = point.get(
Expand All @@ -47,6 +46,11 @@ def __init__(self, timestamp, point):
self.radiation_diffuse_accumulation = point.get(
'radiation_diffuse_accumulation', None)

try:
self.weather_symbol = int(point.get('weather_symbol', 0))
except ValueError:
self.weather_symbol = None

def __repr__(self):
return '<%s: %s - %.1f C>' % (
self.__class__.__name__,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

setup(
name='fmi_weather',
version='1.1.1',
version='1.1.2',
description='FMI weather data fetcher',
author='Kimmo Huoman',
author_email='[email protected]',
Expand Down

0 comments on commit 293e462

Please sign in to comment.