From 86fac40368c475b170a5afbcb9ca1ea2d1118574 Mon Sep 17 00:00:00 2001 From: Evgeny Date: Sun, 23 Jun 2024 17:08:49 +0200 Subject: [PATCH] Visiblity is optional --- src/pyopenweathermap/data_converter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pyopenweathermap/data_converter.py b/src/pyopenweathermap/data_converter.py index d6cea6b..eaf8bd2 100644 --- a/src/pyopenweathermap/data_converter.py +++ b/src/pyopenweathermap/data_converter.py @@ -15,7 +15,7 @@ def onecall_to_current_weather(json): dew_point=json['dew_point'], uv_index=json['uvi'], cloud_coverage=json['clouds'], - visibility=json['visibility'], + visibility=json.get('visibility', None), wind_speed=json['wind_speed'], wind_gust=json.get('wind_gust'), wind_bearing=json['wind_deg'], @@ -77,7 +77,7 @@ def freemium_to_current_weather(json): dew_point=None, uv_index=None, cloud_coverage=json['clouds'], - visibility=json['visibility'], + visibility=json.get('visibility', None), wind_speed=json['wind']['speed'], wind_gust=json['wind'].get('gust'), wind_bearing=json['wind']['deg'],