UGREEN NAS Simple Python SDK
Project description
UGREEN NAS Simple Python SDK
UGREEN is a PRIVATE API based Simple SDK being developed for NAS servers. NOT AN OFFICIAL DOCUMENT!
RSI Public key Creation
To use the SDK, connect to your NAS server via SSH and open the example 999.pub file of your user uid in the /var/cache/ugreen-rsa folder as cat 999.pub, copy the content and save it into your project as public_key.pem as below
Now that the RSA Public key is set, you are ready to use the SDK
init
- Copy the downloaded pem file into the project file
nas = UgreenNAS("<nas_ip>", <port>, "<username>", "<password>", "public_key.pem")
Connection check
connection, code, msg = nas.isConnect()
Success: (True, 200, 'success')
Error: (False, 1003, 'Wrong account or password. Please enter again')
Get User Token
token = nas.getToken()
Success: d698b3a91b58d2008d2737883683c3d7
Error: None
Chek Handshake
chekHandshake = nas.chekHandshake("<token>")
Success: (200, 'success')
Error: (1024, 'Authorization timeout, please login again!')
Get User Image
- returns the image as a variable
image = getUserImage()
Save User Image
- If "" is empty, it saves directly into the project file, for example, you can create an img folder and save it as "img/"
nas.saveUserImage("<folder>","uguraltnsy.jpg")
Priority Link
priority_link = nas.priorityLink()
Success:
{
"ddns": [],
"host": "111.111.111.111",
"uglink": "",
"uglink_id": "",
"ipv_4": [
"111.111.111.111"
],
"ipv_6": [],
"http_port": 9999,
"https_port": 9443
}
Error: Authorization timeout, please login again!
Sysinfo
sysInfo = nas.sysInfo()
Success:
{
"common": {
"nas_name": "DXP4800PLUS",
"uglink_id": "",
"nas_owner": "{owner_email}",
"model": "DXP4800 Plus",
"serial": "{serial_number}",
"mac": [
"{mac_1}",
"{mac_2}"
],
"system_version": "1.0.0.0940",
"run_time": 200635,
"last_turn_on_time": "2024-07-08 14:45:43",
"repair_start_time": 0,
"repair_end_time": 0
},
"hardware": {
"cpu": [
{
"model": "Intel(R) Pentium(R) Gold 8505",
"ghz": 4400,
"core": 5,
"thread": 6,
"temperature": 42
}
],
"mem": [
{
"model": "M425R1GB4BB0-CQKOL",
"size": 8589934592,
"mhz": "4800 MHz"
}
],
"net": [
{
"model": "eth1",
"ip": "-",
"mac": "{mac_1}"
},
{
"model": "eth0",
"ip": "-",
"mac": "{mac_2}"
}
],
"ups": null,
"usb": null
}
}
Error: Authorization timeout, please login again!
System Status
systemStatus = nas.systemStatus()
Success:
{
"dev_name": "DXP4800PLUS",
"last_boot_date": "07-08 14:45",
"last_boot_time": 1720439143,
"message": "The system is running normally.",
"status": 0,
"total_run_time": 200835,
"type": 2
}
Error: Authorization timeout, please login again!
Device Monitoring
deviceMonitoring = nas.deviceMonitoring()
Success:
{
"cpu_usage_rate": 0.67,
"download_speed": {
"unit": "KB/s",
"value": 2.4
},
"ram_usage_rate": "13.09",
"type": 3,
"upload_speed": {
"unit": "KB/s",
"value": 0.06
}
}
Error: Authorization timeout, please login again!
Temperature Monitoring
temperatureMonitoring = nas.temperatureMonitoring()
Success:
{
"cpu_status": 0,
"cpu_temperature": 43,
"disk_list": [],
"fan_speed": 590,
"fan_status": 0,
"message": "The temperature is normal, and the heat dissipation is good.",
"status": 0,
"type": 6
}
Error: Authorization timeout, please login again!
Storage Space
storageSpace = nas.storageSpace()
Success:
{
"storage_list": null,
"type": 4
}
Error: Authorization timeout, please login again!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ugreennas-0.0.1.tar.gz.
File metadata
- Download URL: ugreennas-0.0.1.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0bceffb001fd30cc3a912ee85a905cdd638d580e15928e6c2678dff604df329
|
|
| MD5 |
34e1cec8a078a3ee69d4a673e17622e2
|
|
| BLAKE2b-256 |
be416f783550017f57f89050e631b36fa69c3708c4c8a8346f4718c48be93a2e
|