-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathweather_api.py
More file actions
27 lines (13 loc) · 770 Bytes
/
Copy pathweather_api.py
File metadata and controls
27 lines (13 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
import json
url1 = 'https://api.open-meteo.com/v1/forecast?latitude=48.52&longitude=13.41¤t=temperature_2m,wind_speed_10m&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m'
response = requests.get(url1)
data = response.json()
print("Aktuelle Zeit:", data["current"]["time"])
print("Temperatur:", data["current"]["temperature_2m"])
print("Wind:", data["current"]["wind_speed_10m"])
# stündliche Zeiten ausgeben
for time in data["hourly"]["time"]:
print(time)
"""https://api.open-meteo.com/v1/forecast?latitude=52.52&longitude=13.41¤t=temperature_2m,wind_speed_10m&hourly=temperature_2m,relative_humidity_2m,wind_speed_10m"
'https://api.stackexchange.com/2.3/questions?order=desc&sort=activity&site=stackoverflow'"""