I'm trying to retrieve data from weather stations,.
First I get a list of all stations around Zürich:
Code: Select all
def _query(url, token="...."):
response = requests.get(
url,
headers={
"accept": "application/json",
"Authorization": f"Bearer {token}"
}
)
#response.raise_for_status()
return response
url = https://api.netatmo.com/api/getpublicdata?lat_ne=47.433023&lon_ne=8.629538&lat_sw=47.354699&lon_sw=8.472868&filter=false
data = _query(url)
Code: Select all
{'_id': '70:ee:50:00:45:30',
'place': {'location': [8.634436400000027, 47.42281870000001],
'timezone': 'Europe/Zurich',
'country': 'CH',
'altitude': 454,
'city': 'Wangen-Brüttisellen',
'street': 'Chileweg'},
'mark': 12,
'measures': {'02:00:00:00:5a:9a': {'res': {'1589985581': [23.8, 40]},
'type': ['temperature', 'humidity']},
'70:ee:50:00:45:30': {'res': {'1589985609': [1022.4]}, 'type': ['pressure']},
'05:00:00:00:37:fc': {'rain_60min': 0,
'rain_24h': 0,
'rain_live': 0,
'rain_timeutc': 1589985600},
'06:00:00:01:4b:54': {'wind_strength': 7,
'wind_angle': 72,
'gust_strength': 16,
'gust_angle': 79,
'wind_timeutc': 1589985607}},
'modules': ['02:00:00:00:5a:9a', '06:00:00:01:4b:54', '05:00:00:00:37:fc'],
'module_types': {'02:00:00:00:5a:9a': 'NAModule1',
'06:00:00:01:4b:54': 'NAModule2',
'05:00:00:00:37:fc': 'NAModule3'}}
To retrieve the station data I run:
Code: Select all
url = https://api.netatmo.com/api/getstationsdata?device_id=70%3Aee%3A50%3A00%3A45%3A30&get_favorites=false
data = _query(url)
Code: Select all
{'error': {'code': 9, 'message': 'Device not found'}}
Thank you very much!!