Skip to content

Commit b1e6453

Browse files
committed
add info function
return general information about the cloudkey (and site)
1 parent 1cdc9fd commit b1e6453

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

ubiquiti/unifi.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,36 @@ def health(self) -> dict:
124124
data = r.json()['data']
125125

126126
return data[0]
127+
128+
def info(self) -> dict:
129+
"""
130+
List site information.
131+
:return: A dict of site information (see below for a sample)
132+
autobackup
133+
build
134+
cloudkey_update_version
135+
cloudkey_version
136+
data_retention_days
137+
debug_system
138+
eol_pending_device_count
139+
hostname
140+
https_port
141+
inform_port
142+
ip_addrs
143+
name
144+
timezone
145+
unifi_go_enabled
146+
update_available
147+
version
148+
"""
149+
r = self._session.get("{}/api/s/{}/stat/sysinfo".format(self._baseurl, self._site, verify=False), data="json={}")
150+
self._current_status_code = r.status_code
151+
if self._current_status_code == 401:
152+
raise LoggedInException("Invalid login, or login has expired")
153+
154+
data = r.json()['data']
155+
156+
return data[0]
127157
if self._current_status_code == 401:
128158
raise LoggedInException("Invalid login, or login has expired")
129159

0 commit comments

Comments
 (0)