-
Notifications
You must be signed in to change notification settings - Fork 1
/
weather.py
32 lines (29 loc) · 995 Bytes
/
weather.py
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
28
29
30
31
32
import requests
def getWeatherInfoGeo(lat, lng):
url = "http://localhost:5000/api/ambeedata/weather?lat={}&lng={}".format(lat, lng)
results = requests.get(url)
data = results.json()
time = data["data"]["time"]
temperature = data["data"]["temperature"]
dewPoint = data["data"]["dewPoint"]
humidity = data["data"]["humidity"]
pressure = data["data"]["pressure"]
windSpeed = data["data"]["windSpeed"]
windGust = data["data"]["windGust"]
windBearing = data["data"]["windBearing"]
cloudCover = data["data"]["cloudCover"]
visibility = data["data"]["visibility"]
ozone = data["data"]["ozone"]
info = {
"temperature": temperature,
"dewPoint": dewPoint,
"humidity": humidity,
"pressure": pressure,
"windSpeed": windSpeed,
"windGust": windGust,
"windBearing": windBearing,
"cloudCover": cloudCover,
"visibility": visibility,
"ozone": ozone
}
return info