Skip to content

Instantly share code, notes, and snippets.

@grinsted
Created September 16, 2025 06:57
Show Gist options
  • Save grinsted/bc45912e7e535e62f09a06e757038f34 to your computer and use it in GitHub Desktop.
Save grinsted/bc45912e7e535e62f09a06e757038f34 to your computer and use it in GitHub Desktop.
minimal test of Northbound login, and fetching of station list
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)
@grinsted
Copy link
Author

This gist relates to this issue: tijsverkoyen/HomeAssistant-FusionSolar#265

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment