Skip to content

Instantly share code, notes, and snippets.

@vschlegel
Created October 28, 2020 20:29
Show Gist options
  • Save vschlegel/ed0bee31059325dff83c489a10ac8081 to your computer and use it in GitHub Desktop.
Save vschlegel/ed0bee31059325dff83c489a10ac8081 to your computer and use it in GitHub Desktop.
#!/usr/bin/python3.8
import requests
import urllib.parse
key= "xxxxx" # <-- Insert your own OpenWeatherMap API Key (https://openweathermap.org/api)
lat = "47.4212"
lon = "10.9863"
json = requests.get("http://api.openweathermap.org/data/2.5/weather?lat={}&lon={}&appid={}".format(lat, lon, key)).json()
if 'snow' in json:
print("Es schneit auf der Zugspitze");
else:
print("Es schneit nicht auf der Zugspitze");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment