about summary refs log tree commit diff
path: root/scripts/weather.py
diff options
context:
space:
mode:
authorManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-08-18 17:27:48 +0200
committerManuel Palenzuela <manuelpalenzuelamerino@gmail.com>2019-08-18 17:27:48 +0200
commita68a654ab7e24a4c7c5346f4f205feb3cc272ab7 (patch)
tree8ba308ffd7120f808b38e04aa3172267c761df24 /scripts/weather.py
parentChanged order of wifi icon in dwm-status (diff)
downloaddwm-a68a654ab7e24a4c7c5346f4f205feb3cc272ab7.tar.gz
dwm-a68a654ab7e24a4c7c5346f4f205feb3cc272ab7.tar.bz2
dwm-a68a654ab7e24a4c7c5346f4f205feb3cc272ab7.zip
Refracted weather info in status bar
Diffstat (limited to '')
-rw-r--r--scripts/weather.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/scripts/weather.py b/scripts/weather.py
deleted file mode 100644
index f6be64a..0000000
--- a/scripts/weather.py
+++ /dev/null
@@ -1,46 +0,0 @@
-#!/bin/python
-
-import requests
-import os
-
-delim="|"
-
-# Check for an internet connection
-url='http://www.google.com/'
-timeout=5
-try:
-    _ = requests.get(url, timeout=timeout)
-    internet = True
-except requests.ConnectionError:
-    internet = False
-
-#COORDINATES = open("/usr/share/geolocate/.location", 'r').read()
-#LOCATION = "lat=" + COORDINATES.replace(":","&lon=")
-
-API_KEY = "756edce7e9d4c385ef9499a53492678c"
-UNITS = "Metric"
-UNIT_KEY = "C"
-#UNIT_KEY = "F"
-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")
-    try:
-    # HTTP CODE = OK
-        if REQ.status_code == 200:
-            CURRENT = REQ.json()["weather"][0]["description"].capitalize()
-            TEMP = int(float(REQ.json()["main"]["temp"]))
-            print(" {}, {} °{}".format(CURRENT, TEMP, UNIT_KEY))
-            print(delim)
-        else:
-            print("Error: BAD HTTP STATUS CODE " + str(REQ.status_code))
-    except (ValueError, IOError):
-            print("Error: Unable print the data")
-else:
-    print("")