mirror of
https://github.com/olexsmir/dotfiles.git
synced 2026-01-15 08:41:34 +02:00
Update
This commit is contained in:
parent
0d2b7d6ba3
commit
7cf1432163
50 changed files with 1576 additions and 977 deletions
|
|
@ -2,14 +2,13 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import requests, os
|
||||
|
||||
|
||||
API_KEY = os.getenv("OWM_POLYBAR")
|
||||
CITY = "Horodnytsya,UA"
|
||||
|
||||
try:
|
||||
JSON = requests.get(f"http://api.openweathermap.org/data/2.5/weather?q={CITY}&lang=EN&&units=metric&appid={API_KEY}").json()
|
||||
except Exception as e:
|
||||
print("No connection ")
|
||||
|
||||
try: JSON = requests.get(f"http://api.openweathermap.org/data/2.5/weather?q={CITY}&lang=EN&&units=metric&appid={API_KEY}").json()
|
||||
except Exception as e: print("No connection ")
|
||||
try:
|
||||
if JSON['weather'][0]['main'] == "Clear": print("", int(JSON["main"]["temp"]),"°С")
|
||||
elif JSON['weather'][0]['main'] == "Thunderstorm": print("", int(JSON["main"]["temp"]),"°С")
|
||||
|
|
@ -26,5 +25,4 @@ try:
|
|||
elif JSON['weather'][0]['main'] == "Squall": print("", int(JSON["main"]["temp"]),"°С")
|
||||
elif JSON['weather'][0]['main'] == "Tornado": print("", int(JSON["main"]["temp"]),"°С")
|
||||
elif JSON['weather'][0]['main'] == "Clouds": print("", int(JSON["main"]["temp"]),"°С")
|
||||
except Exception as e:
|
||||
print(int(JSON["main"]["temp"]),"°С")
|
||||
except Exception as e: print(int(JSON["main"]["temp"]),"°С")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue