API problems at the moment?

The Netatmo API is a set of webservices allowing developers and third parties to access Netatmo device's data.
Post Reply
BlackChart
Posts: 1
Joined: 01 Jun 2019, 10:28

API problems at the moment?

Post by BlackChart » 01 Jun 2019, 10:32

Can't seem to find anything stating any API problems, but it have stopped working for my app :(

Code: Select all

#This code sample uses requests (HTTP library)
import requests

payload = {'grant_type': 'password',
           'username': "MY_EMAIL",
           'password': "MY_PASSWORD",
           'client_id':"APP_ID",
           'client_secret': "APP_SECRET",
           'scope': 'read_thermostat write_thermostat read_station'}
try:
    response = requests.post("https://api.netatmo.com/oauth2/token", data=payload)
    response.raise_for_status()
    access_token=response.json()["access_token"]
    refresh_token=response.json()["refresh_token"]
    scope=response.json()["scope"]
    print("Your access token is:", access_token)
    print("Your refresh token is:", refresh_token)
    print("Your scopes are:", scope)
except requests.exceptions.HTTPError as error:
    print(error.response.status_code, error.response.text)

params = {
    'access_token': access_token
}

try:
    response = requests.post("https://api.netatmo.com/api/getthermostatsdata", params=params)
    response.raise_for_status()
    data = response.json()["body"]
except requests.exceptions.HTTPError as error:
    print(error.response.status_code, error.response.text)
This code returns this data:

Code: Select all

{"body":{"devices":[],"user":{"mail":"MY_EMAIL","administrative":{"lang":"en-GB","reg_locale":"en-DK","country":"EN_DK","unit":0,"windunit":0,"pressureunit":0,"feel_like_algo":0}}},"status":"ok","time_exec":0.033841133117676,"time_server":1559377616}
And I have 2 thermostats present at the moment.

Post Reply

Return to “Netatmo API”