fixed more stuff with waybar
This commit is contained in:
@@ -19,12 +19,13 @@ def get_weather_icon(description):
|
||||
"few clouds": "",
|
||||
"scattered clouds": "",
|
||||
"broken clouds": "",
|
||||
"overcast clouds": "",
|
||||
"shower rain": "",
|
||||
"light rain": "",
|
||||
"rain": "",
|
||||
"thunderstorm": "",
|
||||
"snow": "",
|
||||
"mist": "",
|
||||
"overcast clouds": "",
|
||||
}
|
||||
return icons.get(description, "❓")
|
||||
|
||||
@@ -37,11 +38,12 @@ try:
|
||||
weather_data = response.json()
|
||||
|
||||
weather_desc = weather_data["weather"][0]["description"]
|
||||
temp_c = weather_data["main"]["temp"]
|
||||
temp_f = celsius_to_fahrenheit(temp_c)
|
||||
# print(weather_desc)
|
||||
temp_c = round(weather_data["main"]["temp"])
|
||||
temp_f = round(celsius_to_fahrenheit(temp_c))
|
||||
weather_icon = get_weather_icon(weather_desc)
|
||||
|
||||
print(f"{weather_icon} {temp_c:.1f}°C / {temp_f:.1f}°F")
|
||||
print(f"{weather_icon} {temp_c}°C / {temp_f}°F")
|
||||
|
||||
except requests.exceptions.RequestException as e:
|
||||
print(f"Error: {e}")
|
||||
|
||||
Reference in New Issue
Block a user