-
Notifications
You must be signed in to change notification settings - Fork 1
/
pollen.py
23 lines (20 loc) · 897 Bytes
/
pollen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import requests
def getPollenInfoGeo(lat, lng):
url = "http://localhost:5000/api/ambeedata/pollen?lat={}&lng={}".format(lat, lng)
results = requests.get(url)
data = results.json()
grass_pollen_count = data["data"][0]["Count"]["grass_pollen"]
tree_pollen_count = data["data"][0]["Count"]["tree_pollen"]
weed_pollen_count = data["data"][0]["Count"]["weed_pollen"]
grass_pollen_risk = data["data"][0]["Risk"]["grass_pollen"]
tree_pollen_risk = data["data"][0]["Risk"]["tree_pollen"]
weed_pollen_risk = data["data"][0]["Risk"]["weed_pollen"]
info = {
"grass_pollen_count": grass_pollen_count,
"tree_pollen_count": tree_pollen_count,
"weed_pollen_count": weed_pollen_count,
"grass_pollen_risk": grass_pollen_risk,
"tree_pollen_risk": tree_pollen_risk,
"weed_pollen_risk": weed_pollen_risk
}
return info