1
0
mirror of https://github.com/python-escpos/python-escpos synced 2025-12-02 09:43:30 +00:00

Weather Script Debugged

Added one more Icon
Attributed Icons in readme.md
changed folder structure
This commit is contained in:
mrwunderbar666
2017-07-31 09:42:38 +08:00
parent 17831593cf
commit 07c21a7d11
12 changed files with 12 additions and 2 deletions

View File

@@ -34,7 +34,7 @@ LONG = "114.189945" # Your Location
def forecast_icon(idx):
icon = data['daily']['data'][idx]['icon']
image = "/graphics/" + icon + ".png"
image = "/graphics/climacons/" + icon + ".png"
return image
@@ -75,7 +75,7 @@ def icon():
deg = ' C' # Degree symbol on thermal printer, need to find a better way to use a proper degree symbol
# if you want Fahrenheit change units= to 'us'
url = "https://api.darksky.net/forecast/"+API_KEY+"/"+LAT+","+LONG+"?exclude=[alerts,minutely,hourly,flags]&units=si"
url = "https://api.darksky.net/forecast/"+API_KEY+"/"+LAT+","+LONG+"?exclude=[alerts,minutely,hourly,flags]&units=si" #change last bit to 'us' for Fahrenheit
response = urllib.urlopen(url)
data = json.loads(response.read())