json update
This commit is contained in:
6
app.py
6
app.py
@ -53,19 +53,19 @@ class UnifiAPI:
|
||||
'X-API-KEY': config['unifi']['api_key'],
|
||||
'Accept': 'application/json'
|
||||
}
|
||||
self.site_id = "default" # Use default site for now
|
||||
self.site_id = "default"
|
||||
|
||||
def get_all_devices(self):
|
||||
url = f"{self.base_url}/proxy/network/v2/api/site/{self.site_id}/device"
|
||||
response = self.session.get(url, headers=self.headers)
|
||||
response.raise_for_status()
|
||||
return response.json()['data']
|
||||
return response.json() # Return the full response
|
||||
|
||||
def get_device_details(self, device_id):
|
||||
url = f"{self.base_url}/proxy/network/v2/api/site/{self.site_id}/device/{device_id}"
|
||||
response = self.session.get(url, headers=self.headers)
|
||||
response.raise_for_status()
|
||||
return response.json()['data']
|
||||
return response.json() # Return the full response
|
||||
|
||||
def get_device_diagnostics(self, device):
|
||||
details = self.get_device_details(device['ip'])
|
||||
|
||||
Reference in New Issue
Block a user