Commit 979ce95c authored by chrissi^'s avatar chrissi^

Adapt stand-alone desktop use

Signed-off-by: chrissi^'s avatarChris Fiege <chris@tinyhost.de>
parent c0c13a98
#!/bin/bash
/home/chris/Projekte/wetterbaer/baerparser.py > /dev/null
/home/chris/Projekte/wetterbaer/get.py
......@@ -6,21 +6,24 @@ import json
from requests.packages.urllib3.exceptions import InsecureRequestWarning
requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
src = "http://graph.tinyhost.de/cgi/baerparser.py"
src = "/home/chris/Projekte/wetterbaer/cache.json"
try:
weather = json.loads(requests.get(src, verify=False).text)
with open(src) as fh:
weather = json.load(fh)
flags = ""
if weather["percipitation_rate"]["value"] > 0:
flags += u" 🌧"
print u"{}°C, {}%rH {}".format(weather["t_curr"]["value"], weather["h_curr"]["value"], flags).encode('utf-8')
print u"{}°C {}".format(weather["t_curr"]["value"], flags).encode('utf-8')
except requests.exceptions.SSLError:
print "SSLError!"
except requests.exceptions.ConnectionError:
print "ConnError!"
except KeyError:
print "JsonError"
except IOError:
print "IOError"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment