Python-Unifi-Client 1.2.8__tar.gz → 1.2.9__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.8 → python_unifi_client-1.2.9}/PKG-INFO +1 -1
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/python_unifi_client/client.py +93 -1
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/python_unifi_client.egg-info/PKG-INFO +1 -1
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/setup.py +1 -1
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/README.md +0 -0
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/python_unifi_client/__init__.py +0 -0
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/python_unifi_client.egg-info/SOURCES.txt +0 -0
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/python_unifi_client.egg-info/dependency_links.txt +0 -0
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/python_unifi_client.egg-info/top_level.txt +0 -0
- {python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/setup.cfg +0 -0
|
@@ -1735,6 +1735,64 @@ class Client:
|
|
|
1735
1735
|
def list_radius_profiles(self):
|
|
1736
1736
|
"""Fetch RADIUS profiles"""
|
|
1737
1737
|
return self.fetch_results(f"/api/s/{self._site}/rest/radiusprofile")
|
|
1738
|
+
|
|
1739
|
+
def create_radius_profile(self, data:dict) -> dict | list:
|
|
1740
|
+
"""
|
|
1741
|
+
Creates a new radius profile
|
|
1742
|
+
|
|
1743
|
+
Args:
|
|
1744
|
+
data (dict):
|
|
1745
|
+
- name (str): Profile display name
|
|
1746
|
+
- use_usg_auth_server (bool): False (we supply our own servers)
|
|
1747
|
+
- auth_servers (list[dict]): Authentication Servers, each with:
|
|
1748
|
+
- ip (str): Radius Server IP
|
|
1749
|
+
- port (int): Auth port (typically 1812)
|
|
1750
|
+
- x_secret (str): Shared secret
|
|
1751
|
+
- accounting_enabled (bool): True to enable Radius accounting
|
|
1752
|
+
Returns:
|
|
1753
|
+
list/dict: Created profile data (includes '_id' field)
|
|
1754
|
+
"""
|
|
1755
|
+
self._curl_method = 'POST'
|
|
1756
|
+
result = self.fetch_results(f'/api/s/{self._site}/rest/radiusprofile')
|
|
1757
|
+
self._curl_method = 'GET'
|
|
1758
|
+
return result
|
|
1759
|
+
|
|
1760
|
+
def set_radius_profile(self, profile_id:str, data:dict) -> dict | bool:
|
|
1761
|
+
"""
|
|
1762
|
+
Update an existing Radius Profile
|
|
1763
|
+
|
|
1764
|
+
Args:
|
|
1765
|
+
- profile_id (str): The '_id' of the profile to update
|
|
1766
|
+
- data (dict):
|
|
1767
|
+
- name (str): Profile display name
|
|
1768
|
+
- use_usg_auth_server (bool): False (we supply our own servers)
|
|
1769
|
+
- auth_servers (list[dict]): Authentication Servers, each with:
|
|
1770
|
+
- ip (str): Radius Server IP
|
|
1771
|
+
- port (int): Auth port (typically 1812)
|
|
1772
|
+
- x_secret (str): Shared secret
|
|
1773
|
+
- accounting_enabled (bool): True to enable Radius accounting
|
|
1774
|
+
Returns:
|
|
1775
|
+
bool/dict: Success indicator or updated profile data
|
|
1776
|
+
"""
|
|
1777
|
+
self._curl_method = 'PUT'
|
|
1778
|
+
result = self.fetch_results(f'/api/s/{self._site}/rest/radiusprofile/{profile_id}')
|
|
1779
|
+
self._curl_method = 'GET'
|
|
1780
|
+
return result
|
|
1781
|
+
|
|
1782
|
+
def delete_radius_profile(self, profile_id:str) -> bool:
|
|
1783
|
+
"""
|
|
1784
|
+
Delete a Radius Profile
|
|
1785
|
+
|
|
1786
|
+
Args:
|
|
1787
|
+
profile_id (str): The '_id' of the profile to delete
|
|
1788
|
+
|
|
1789
|
+
Returns:
|
|
1790
|
+
bool: Success indicator
|
|
1791
|
+
"""
|
|
1792
|
+
self._curl_method = 'DELETE'
|
|
1793
|
+
result = self.fetch_results(f'/api/s/{self.site}/rest/radiusprofile{profile_id}')
|
|
1794
|
+
self._curl_method = 'GET'
|
|
1795
|
+
return result
|
|
1738
1796
|
|
|
1739
1797
|
def create_radius_account(self, name: str, x_password: str, tunnel_type: int = None, tunnel_medium_type: int = None, vlan: str = None) -> dict:
|
|
1740
1798
|
"""Create a Radius user account with optional tunneling parameters and VLAN"""
|
|
@@ -2990,4 +3048,38 @@ class Client:
|
|
|
2990
3048
|
|
|
2991
3049
|
payload = {'email': email, 'is_resend': True}
|
|
2992
3050
|
self._curl_method = 'POST'
|
|
2993
|
-
return self.fetch_results("/api/v2/users/invite_add", payload=payload, proxy_type='users')
|
|
3051
|
+
return self.fetch_results("/api/v2/users/invite_add", payload=payload, proxy_type='users')
|
|
3052
|
+
|
|
3053
|
+
def transfer_ownership(client:Client, email:str):
|
|
3054
|
+
"""
|
|
3055
|
+
Transfer ownership of the udm
|
|
3056
|
+
|
|
3057
|
+
Args:
|
|
3058
|
+
client -> Unifi Client API
|
|
3059
|
+
email -> Email of the account you wish to transfer ownership
|
|
3060
|
+
|
|
3061
|
+
Returns:
|
|
3062
|
+
API response data
|
|
3063
|
+
"""
|
|
3064
|
+
if email is None:
|
|
3065
|
+
return {'msg': 'error', 'error': 'No email was provided'}
|
|
3066
|
+
|
|
3067
|
+
sesh = client._session
|
|
3068
|
+
|
|
3069
|
+
url = f'{client._baseurl}/api/users/owner/transfer'
|
|
3070
|
+
payload = {
|
|
3071
|
+
'email': email,
|
|
3072
|
+
'removeS2S': True
|
|
3073
|
+
}
|
|
3074
|
+
|
|
3075
|
+
result = sesh.post(url=url, json=payload, verify=False)
|
|
3076
|
+
return result.json()
|
|
3077
|
+
|
|
3078
|
+
|
|
3079
|
+
|
|
3080
|
+
client = Client(baseurl='https://47.22.145.45', user='admin', password='29FGVL871##FQj#t', ssl_verify=False, debug=False)
|
|
3081
|
+
client.login()
|
|
3082
|
+
|
|
3083
|
+
result = client.list_radius_profiles()
|
|
3084
|
+
|
|
3085
|
+
print(result)
|
|
@@ -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.9",
|
|
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.8 → python_unifi_client-1.2.9}/python_unifi_client.egg-info/SOURCES.txt
RENAMED
|
File without changes
|
|
File without changes
|
{python_unifi_client-1.2.8 → python_unifi_client-1.2.9}/python_unifi_client.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|