diff options
author | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-08-04 14:54:19 +0200 |
---|---|---|
committer | Manuel Palenzuela <manuelpalenzuelamerino@gmail.com> | 2019-08-04 14:54:19 +0200 |
commit | e1e97ee5c265d47c40f385a625591e68a11f5341 (patch) | |
tree | da994eb44984c94e5575677287ae0a0b07ba26e1 | |
parent | Added ethernet icon dwm-status (diff) | |
download | dwm-e1e97ee5c265d47c40f385a625591e68a11f5341.tar.gz dwm-e1e97ee5c265d47c40f385a625591e68a11f5341.tar.bz2 dwm-e1e97ee5c265d47c40f385a625591e68a11f5341.zip |
Changed location getting in weather.py from geolocate cmd
-rw-r--r-- | scripts/weather.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scripts/weather.py b/scripts/weather.py index 1f4bfba..f6be64a 100644 --- a/scripts/weather.py +++ b/scripts/weather.py @@ -14,8 +14,8 @@ try: except requests.ConnectionError: internet = False -COORDINATES = open("/usr/share/geolocate/.location", 'r').read() -LOCATION = "lat=" + COORDINATES.replace(":","&lon=") +#COORDINATES = open("/usr/share/geolocate/.location", 'r').read() +#LOCATION = "lat=" + COORDINATES.replace(":","&lon=") API_KEY = "756edce7e9d4c385ef9499a53492678c" UNITS = "Metric" @@ -25,6 +25,9 @@ LANG = "en" #LANG = "nl" #LANG = "hu" if internet == True: + COORDINATES = os.popen("geolocate").read() + LOCATION = "lat=" + COORDINATES.replace(":","&lon=") + API="http://api.openweathermap.org/data/2.5/weather?{}&lang={}&appid={}&units={}".format(LOCATION.strip(), LANG, API_KEY, UNITS) REQ = requests.get(API) #REQ = requests.get("http://api.openweathermap.org/data/2.5/weather?lat=50.84660&lon=4.35280&lang=en&appid=756edce7e9d4c385ef9499a53492678c&units=Metric") |