23 lines
731 B
Python
23 lines
731 B
Python
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) |