Hi!
I am working on a small project where I try to connect to a Victron Venus GX using VRM API. My code (in Python) is the following:
import requests
import json
login_url = 'https://vrmapi.victronenergy.com/v2/auth/login'
username = "aaaaa@bbbb.com"
password = "123456"
login_string = '{"username":"'+username+'","password":"'+password+'"}'
response = requests.post(login_url, login_string)
token = json.loads(response.text)["token"]
idSite = "1111111111"
diags_url = 'https://vrmapi.victronenergy.com/v2/installations/'+idSite+'/diagnostics'
querystring = {"count":"1000"}
headers = {
"Content-Type": "application/json",
"x-authorization": "Bearer <"+token+">"
}
response = requests.request("GET",diags_url, headers=headers, params=querystring)
print(response.json)
print(response.text)
I try this script but the response I get is like:
<bound method Response.json of <Response [401]>>
{"success":false,"errors":"Token is invalid","error_code":"invalid_token"}
Any idea and/or can someone support me?
Many thanks in advance
JavierAG