Tweaking, including reducing sig figs in weather

This commit is contained in:
2026-05-26 21:02:58 +00:00
parent e3338fc3f6
commit d74939cc0e
3 changed files with 16 additions and 11 deletions

View File

@@ -70,7 +70,7 @@ def get_google_weather():
humidity = current_data.get("relativeHumidity")
theweather["current"] = (f"{condition}") + (f", {temp.get('degrees')}°F")\
+ (f", {humidity}%") + (f" hum., Feels like: {feels_like.get('degrees')}°F")
+ (f", {humidity}%") + (f" hum., Feels like: {int(feels_like.get('degrees'))}°F")
else: # current_data not returned
theweather["current"] = "Problem retrieving current weather"
@@ -81,12 +81,12 @@ def get_google_weather():
max_temp = day.get("maxTemperature", {}).get("degrees")
min_temp = day.get("minTemperature", {}).get("degrees")
condition = day.get("daytimeForecast", {}).get("weatherCondition", {}).get("description", {}).get("text")
theweather["forecast_today"] = (f"{condition}") + (f", {min_temp}°F-{max_temp}°F")
theweather["forecast_today"] = (f"{condition}") + (f", {int(min_temp)}°F-{int(max_temp)}°F")
day = forecast_data.get("forecastDays", [])[1]
max_temp = day.get("maxTemperature", {}).get("degrees")
min_temp = day.get("minTemperature", {}).get("degrees")
condition = day.get("daytimeForecast", {}).get("weatherCondition", {}).get("description", {}).get("text")
theweather["forecast_tomorrow"] = (f"{condition}") + (f", {min_temp}°F-{max_temp}°F")
theweather["forecast_tomorrow"] = (f"{condition}") + (f", {int(min_temp)}°F-{int(max_temp)}°F")
else:
theweather["forecast_tomorrow"] = "Problem retrieving weather forecast"