Created
September 16, 2025 06:57
-
-
Save grinsted/bc45912e7e535e62f09a06e757038f34 to your computer and use it in GitHub Desktop.
minimal test of Northbound login, and fetching of station list
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
_host= 'https://eu5.fusionsolar.huawei.com' | |
_username = 'test' | |
_password = 'test' | |
url = _host + '/thirdData/login' | |
headers = { | |
'accept': 'application/json', | |
} | |
json = { | |
'userName': _username, | |
'systemCode': _password, | |
} | |
response = requests.post(url, headers=headers, json=json) | |
print(response.text) | |
_token = response.headers['xsrf-token'] | |
print(_token) | |
url = _host + '/thirdData/getStationList' | |
json = {} | |
headers = { | |
'Content-Type': 'application/json', | |
'XSRF-TOKEN': _token, | |
} | |
response = requests.post(url, headers=headers, json=json) | |
print(response.text) | |
#----------new paginated way------------ | |
#https://support.huawei.com/enterprise/en/doc/EDOC1100492747/c63576c8/querying-the-plant-list | |
url = _host + '/thirdData/stations' | |
json = {'pageNo':1} | |
headers = { | |
'Content-Type': 'application/json', | |
'XSRF-TOKEN': _token, | |
} | |
response = requests.post(url, headers=headers, json=json) | |
print(response.text) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This gist relates to this issue: tijsverkoyen/HomeAssistant-FusionSolar#265