Skip to content

Commit

Permalink
fix: #611 if current not exist use main section to get temperature
Browse files Browse the repository at this point in the history
  • Loading branch information
flobz committed Jan 15, 2024
1 parent 004b9ef commit 8d35953
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion psa_car_controller/psacc/utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ def get_temp(latitude: str, longitude: str, api_key: str) -> float:
"appid": api_key,
"units": "metric"},
timeout=TIMEOUT_IN_S)
temp = weather_rep.json()["current"]["temp"]
weather_res_json = weather_rep.json()
temp = weather_res_json.get("current", weather_res_json.get("main"))["temp"]
logger.debug("Temperature :%fc", temp)
return temp
except ConnectionError:
Expand Down

0 comments on commit 8d35953

Please sign in to comment.