wetterinfo angefügt
This commit is contained in:
1 parent
ed7fd71368
commit
a5b9e96ebd
5 files changed
+119
-5
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import requests
|
||||
import json
|
||||
|
||||
def dingens():
|
||||
api_key = "536479df69dcad6956b0c27300e8fddb"
|
||||
lat = "50.63856454090637"
|
||||
lon = "7.5160431030656145"
|
||||
#url = "https://api.openweathermap.org/data/3.0/onecall?lat=%s&lon=%s&appid=%s&units=metric" % (lat, lon, api_key)
|
||||
url = "https://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&appid=%s&units=metric&lang=de" % (lat, lon, api_key)
|
||||
response = requests.get(url)
|
||||
data = json.loads(response.text)
|
||||
#print(data)
|
||||
|
||||
current = data["main"]["temp"]
|
||||
wetterString=""+str(current)+"°C|"
|
||||
#print(current)
|
||||
current = data["weather"][0]["description"]
|
||||
#print(current)
|
||||
wetterString+= current+"|"
|
||||
return wetterString
|
||||
|
||||
erg=dingens()
|
||||
print (erg)
|
||||
Reference in new issue
Block a user