python-unifi-client 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- python_unifi_client-1.1.0/PKG-INFO +96 -0
- python_unifi_client-1.1.0/README.md +77 -0
- python_unifi_client-1.1.0/python-unifi-client/__init__.py +1 -0
- python_unifi_client-1.1.0/python-unifi-client/client.py +2607 -0
- python_unifi_client-1.1.0/python_unifi_client.egg-info/PKG-INFO +96 -0
- python_unifi_client-1.1.0/python_unifi_client.egg-info/SOURCES.txt +8 -0
- python_unifi_client-1.1.0/python_unifi_client.egg-info/dependency_links.txt +1 -0
- python_unifi_client-1.1.0/python_unifi_client.egg-info/top_level.txt +1 -0
- python_unifi_client-1.1.0/setup.cfg +4 -0
- python_unifi_client-1.1.0/setup.py +22 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: python_unifi_client
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Home-page: https://github.com/compdat-llc/unifi-client-python
|
|
5
|
+
Author: Michael Lapinski
|
|
6
|
+
Author-email: michaellapinski787@gmail.com
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
9
|
+
Classifier: Operating System :: OS Independent
|
|
10
|
+
Requires-Python: >=3.8, <3.14
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
Dynamic: author
|
|
13
|
+
Dynamic: author-email
|
|
14
|
+
Dynamic: classifier
|
|
15
|
+
Dynamic: description
|
|
16
|
+
Dynamic: description-content-type
|
|
17
|
+
Dynamic: home-page
|
|
18
|
+
Dynamic: requires-python
|
|
19
|
+
|
|
20
|
+
# UniFi API Client Python Port
|
|
21
|
+
|
|
22
|
+
A Python port of the [Art_of_WiFi/Unifi_API_Client](https://github.com/Art-of-WiFi/Unifi-API-client) library for interacting with Ubiquiti UniFi controllers.
|
|
23
|
+
This project preserves the original PHP functionality via Pythons `requests` and offers:
|
|
24
|
+
|
|
25
|
+
- cURL_style options mirroring the PHP implementation
|
|
26
|
+
- Session management (login/logout)
|
|
27
|
+
- Controller_side backup generation & download
|
|
28
|
+
- Most REST/stat endpoints translated to Python
|
|
29
|
+
|
|
30
|
+
> **Note:** User_management methods (create/update/delete) are currently non‑functional due to authorization/404 errors. Contributions welcome!
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Features
|
|
35
|
+
|
|
36
|
+
- Login to UniFi OS & classic controllers
|
|
37
|
+
- Generate and download network backups
|
|
38
|
+
- Mirror PHPs cURL options for timeouts, headers, SSL, etc.
|
|
39
|
+
- All major API/stat endpoints converted
|
|
40
|
+
- CSRF handling for UniFi OS
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## Dependencies
|
|
45
|
+
|
|
46
|
+
- http
|
|
47
|
+
- sys
|
|
48
|
+
- requests
|
|
49
|
+
- From requests.exceptions import Timeout, RequestException
|
|
50
|
+
- time
|
|
51
|
+
- re
|
|
52
|
+
- json
|
|
53
|
+
- urllib.parse
|
|
54
|
+
- http.client
|
|
55
|
+
- logging
|
|
56
|
+
- base64
|
|
57
|
+
|
|
58
|
+
## Example Usage
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
from client import Client
|
|
62
|
+
|
|
63
|
+
# Initialize (disable SSL verify if using self‑signed certs)
|
|
64
|
+
client = Client(
|
|
65
|
+
user="admin",
|
|
66
|
+
password="secret",
|
|
67
|
+
baseurl="https://your-controller-ip",
|
|
68
|
+
ssl_verify=False
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
# Login
|
|
72
|
+
client.login()
|
|
73
|
+
|
|
74
|
+
# List sites
|
|
75
|
+
sites = client.list_sites()
|
|
76
|
+
print(sites)
|
|
77
|
+
|
|
78
|
+
# Generate & download backup
|
|
79
|
+
bak = client.generate_backup(days=0) # returns [{'url': '/dl/backup/XYZ.unf'}]
|
|
80
|
+
content = client.download_backup(bak[0]['url'])
|
|
81
|
+
with open("backup.unf", "wb") as f:
|
|
82
|
+
f.write(content)
|
|
83
|
+
|
|
84
|
+
# Logout
|
|
85
|
+
client.logout()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Known Issues
|
|
89
|
+
|
|
90
|
+
- User management (create/update/delete) as well as some other admin required permissions return 404/unauthorized
|
|
91
|
+
- Some endpoints don't get met
|
|
92
|
+
|
|
93
|
+
## License
|
|
94
|
+
|
|
95
|
+
- Same as the original github
|
|
96
|
+
- MIT
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# UniFi API Client Python Port
|
|
2
|
+
|
|
3
|
+
A Python port of the [Art_of_WiFi/Unifi_API_Client](https://github.com/Art-of-WiFi/Unifi-API-client) library for interacting with Ubiquiti UniFi controllers.
|
|
4
|
+
This project preserves the original PHP functionality via Pythons `requests` and offers:
|
|
5
|
+
|
|
6
|
+
- cURL_style options mirroring the PHP implementation
|
|
7
|
+
- Session management (login/logout)
|
|
8
|
+
- Controller_side backup generation & download
|
|
9
|
+
- Most REST/stat endpoints translated to Python
|
|
10
|
+
|
|
11
|
+
> **Note:** User_management methods (create/update/delete) are currently non‑functional due to authorization/404 errors. Contributions welcome!
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- Login to UniFi OS & classic controllers
|
|
18
|
+
- Generate and download network backups
|
|
19
|
+
- Mirror PHPs cURL options for timeouts, headers, SSL, etc.
|
|
20
|
+
- All major API/stat endpoints converted
|
|
21
|
+
- CSRF handling for UniFi OS
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
- http
|
|
28
|
+
- sys
|
|
29
|
+
- requests
|
|
30
|
+
- From requests.exceptions import Timeout, RequestException
|
|
31
|
+
- time
|
|
32
|
+
- re
|
|
33
|
+
- json
|
|
34
|
+
- urllib.parse
|
|
35
|
+
- http.client
|
|
36
|
+
- logging
|
|
37
|
+
- base64
|
|
38
|
+
|
|
39
|
+
## Example Usage
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
from client import Client
|
|
43
|
+
|
|
44
|
+
# Initialize (disable SSL verify if using self‑signed certs)
|
|
45
|
+
client = Client(
|
|
46
|
+
user="admin",
|
|
47
|
+
password="secret",
|
|
48
|
+
baseurl="https://your-controller-ip",
|
|
49
|
+
ssl_verify=False
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Login
|
|
53
|
+
client.login()
|
|
54
|
+
|
|
55
|
+
# List sites
|
|
56
|
+
sites = client.list_sites()
|
|
57
|
+
print(sites)
|
|
58
|
+
|
|
59
|
+
# Generate & download backup
|
|
60
|
+
bak = client.generate_backup(days=0) # returns [{'url': '/dl/backup/XYZ.unf'}]
|
|
61
|
+
content = client.download_backup(bak[0]['url'])
|
|
62
|
+
with open("backup.unf", "wb") as f:
|
|
63
|
+
f.write(content)
|
|
64
|
+
|
|
65
|
+
# Logout
|
|
66
|
+
client.logout()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Known Issues
|
|
70
|
+
|
|
71
|
+
- User management (create/update/delete) as well as some other admin required permissions return 404/unauthorized
|
|
72
|
+
- Some endpoints don't get met
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
- Same as the original github
|
|
77
|
+
- MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|