-
After the shut-down of the previous (open) API that Windentrale offered, I found this one that seems to be based on the new "Mijn Windentrale" environment. Having limited knowledge of Python I think this is do-able, but I am completely unfamiliar with e.g. the configuration parts that are currently filled in by Home Assistant. I'd prefer to create a config file or the like with e.g. my credentials that the script will then use to authenticate me before collecting 'my' data. Any suggestion? Or smeone that has worked on the same subject? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The username parameter you should fill in your email address and not a username. But for testing credentials: import json
import requests
import boto3
from pycognito.aws_srp import AWSSRP
boto3_client = boto3.client('cognito-idp', region_name='eu-west-1')
aws = AWSSRP(username='', password='', pool_id='eu-west-1_U7eYBPrBd', client_id='715j3r0trk7o8dqg3md57il7q0', client=boto3_client)
tokens = aws.authenticate_user()
token_type = tokens['AuthenticationResult']['TokenType']
id_token = tokens['AuthenticationResult']['IdToken']
authorization_header = {'Authorization':token_type + " " + id_token}
Request_result = requests.get("https://mijn.windcentrale.nl/api/v0/livedata?projects=WND-WJ", headers=authorization_header, verify=True)
print(Request_result.json()) |
Beta Was this translation helpful? Give feedback.
-
Thx, much appreciated. Meanwhile I also found a (similar) script from Marcel Verpaalen. |
Beta Was this translation helpful? Give feedback.
The username parameter you should fill in your email address and not a username.
But for testing credentials: