all repos

dotfiles @ 246dc34d130d2b6d656dcaa382c5bb47b531b91c

my dotfiles

config/polybar/scripts/weather.py (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import requests
import os


API_KEY = os.getenv("OWM_POLYBAR")
CITY = os.getenv("OWM_CITY")

try:
    JSON = requests.get(f"http://api.openweathermap.org/data/2.5/weather?q={CITY}&lang=EN&&units=metric&appid={API_KEY}").json()
    print("", int(JSON["main"]["temp"]), "°С")
except:
    print(" err °С")