python-unifi-client 1.2.1__tar.gz → 1.2.3__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.2.1 → python_unifi_client-1.2.3}/PKG-INFO +1 -1
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client/client.py +18 -16
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client.egg-info/PKG-INFO +1 -1
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/setup.py +1 -1
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/README.md +0 -0
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client/__init__.py +0 -0
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client.egg-info/SOURCES.txt +0 -0
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client.egg-info/dependency_links.txt +0 -0
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client.egg-info/top_level.txt +0 -0
- {python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/setup.cfg +0 -0
|
@@ -58,8 +58,8 @@ class EmailInvalidException(Exception):
|
|
|
58
58
|
def __init__(self):
|
|
59
59
|
super().__init__("Invalid email address provided")
|
|
60
60
|
class InvalidBaseUrlException(Exception):
|
|
61
|
-
def __init__(self):
|
|
62
|
-
super().__init__(
|
|
61
|
+
def __init__(self, message="The base URL provided is invalid."):
|
|
62
|
+
super().__init__(message)
|
|
63
63
|
class InvalidCurlMethodException(Exception):
|
|
64
64
|
def __init__(self):
|
|
65
65
|
super().__init__("Invalid cURL method provided")
|
|
@@ -263,7 +263,7 @@ class Client:
|
|
|
263
263
|
return self.fetch_results(f"/api/s/{self._site}/stat/sysinfo")
|
|
264
264
|
|
|
265
265
|
def get_clients(self):
|
|
266
|
-
return self.fetch_results(f"/api/s/{self._site}/stat/sta")
|
|
266
|
+
return self.fetch_results(f"/api/s/{self._site}/stat/sta", prefix_path=True)
|
|
267
267
|
|
|
268
268
|
def block_client(self, mac):
|
|
269
269
|
return self._request(f"/api/s/{self._site}/cmd/stamgr", method='POST', payload={'cmd': 'block-sta', 'mac': mac})
|
|
@@ -924,7 +924,7 @@ class Client:
|
|
|
924
924
|
def list_clients(self, mac: str = None):
|
|
925
925
|
"""Fetch online client devices, or single device if MAC provided."""
|
|
926
926
|
path_mac = mac.lower().strip() if isinstance(mac, str) else ''
|
|
927
|
-
return self.fetch_results(f"/api/s/{self._site}/stat/sta/{path_mac}")
|
|
927
|
+
return self.fetch_results(f"/api/s/{self._site}/stat/sta/{path_mac}", prefix_path=True)
|
|
928
928
|
|
|
929
929
|
def list_active_clients(self, include_traffic_usage: bool = True, include_unifi_devices: bool = True):
|
|
930
930
|
"""Fetch active client devices, with optional traffic and UniFi device inclusion."""
|
|
@@ -1549,7 +1549,6 @@ class Client:
|
|
|
1549
1549
|
end: int = None,
|
|
1550
1550
|
page_number: int = 0,
|
|
1551
1551
|
page_size: int = 100,
|
|
1552
|
-
custom_payload: dict = None
|
|
1553
1552
|
) -> list:
|
|
1554
1553
|
"""Fetch system logs filtered by class and time window with pagination"""
|
|
1555
1554
|
# Determine time window
|
|
@@ -1569,8 +1568,8 @@ class Client:
|
|
|
1569
1568
|
if class_ == 'next-ai-alert':
|
|
1570
1569
|
payload['nextAiCategory'] = ['CLIENT', 'DEVICE', 'INTERNET', 'VPN']
|
|
1571
1570
|
elif class_ == 'admin-activity':
|
|
1572
|
-
payload['
|
|
1573
|
-
payload['
|
|
1571
|
+
payload['activityKeys'] = ['ACCESSED_NETWORK_WEB', 'ACCESSED_NETWORK_IOS', 'ACCESSED_NETWORK_ANDROID']
|
|
1572
|
+
payload['changeKeys'] = ['CLIENT', 'DEVICE', 'HOTSPOT', 'INTERNET', 'NETWORK', 'PROFILE', 'ROUTING', 'SECURITY', 'SYSTEM', 'VPN', 'WIFI']
|
|
1574
1573
|
elif class_ == 'update-alert':
|
|
1575
1574
|
payload['systemLogDeviceTypes'] = ['GATEWAYS', 'SWITCHES', 'ACCESS_POINT', 'SMART_POWER', 'BUILDING_TO_BUILDING_BRIDGES', 'UNIFI_LTE']
|
|
1576
1575
|
elif class_ == 'client-alert':
|
|
@@ -1581,11 +1580,12 @@ class Client:
|
|
|
1581
1580
|
elif class_ == 'triggers':
|
|
1582
1581
|
payload['triggerTypes'] = ['TRAFFIC_RULE', 'TRAFFIC_ROUTE', 'FIREWALL_RULE']
|
|
1583
1582
|
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1583
|
+
self._curl_method = "POST"
|
|
1584
|
+
self.debug = False
|
|
1585
|
+
|
|
1586
|
+
path = f"/v2/api/site/{self._site}/system-log/{class_}"
|
|
1587
1587
|
|
|
1588
|
-
return self.fetch_results(
|
|
1588
|
+
return self.fetch_results(path, payload=payload, prefix_path=True)
|
|
1589
1589
|
|
|
1590
1590
|
def delete_radius_account(self, account_id: str) -> bool:
|
|
1591
1591
|
"""Delete a Radius user account"""
|
|
@@ -1651,10 +1651,10 @@ class Client:
|
|
|
1651
1651
|
Fetch UniFi devices, optionally filtered by MAC addresses.
|
|
1652
1652
|
"""
|
|
1653
1653
|
payload = {'macs': [mac.lower() for mac in macs]}
|
|
1654
|
-
return self.fetch_results(f"/api/s/{self._site}/stat/device", payload=payload)
|
|
1654
|
+
return self.fetch_results(f"/api/s/{self._site}/stat/device", payload=payload, prefix_path=True)
|
|
1655
1655
|
|
|
1656
1656
|
def list_devices_basic(self):
|
|
1657
|
-
return self.fetch_results(f"/api/s/{self._site}/stat/device-basic")
|
|
1657
|
+
return self.fetch_results(f"/api/s/{self._site}/stat/device-basic", prefix_path=True)
|
|
1658
1658
|
|
|
1659
1659
|
def check_controller_update(self):
|
|
1660
1660
|
"""
|
|
@@ -2444,9 +2444,11 @@ class Client:
|
|
|
2444
2444
|
opts['data'] = json_payload
|
|
2445
2445
|
|
|
2446
2446
|
# force POST if GET or DELETE
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2447
|
+
|
|
2448
|
+
#if self._curl_method in ('GET', 'DELETE'):
|
|
2449
|
+
# self._curl_method = 'POST'
|
|
2450
|
+
# opts['method'] = 'POST'
|
|
2451
|
+
|
|
2450
2452
|
|
|
2451
2453
|
# 5) set custom method flags
|
|
2452
2454
|
if self._curl_method == 'POST':
|
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
|
5
5
|
|
|
6
6
|
setuptools.setup(
|
|
7
7
|
name="python_unifi_client",
|
|
8
|
-
version="1.2.
|
|
8
|
+
version="1.2.3",
|
|
9
9
|
author="Michael Lapinski",
|
|
10
10
|
author_email="michaellapinski787@gmail.com",
|
|
11
11
|
descripton="A python version of a github Art-of-Wifi/Unifi-API-Client",
|
|
File without changes
|
|
File without changes
|
{python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_unifi_client-1.2.1 → python_unifi_client-1.2.3}/python_unifi_client.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|