updated api endpoint
This commit is contained in:
4
app.py
4
app.py
@ -58,9 +58,8 @@ class UnifiAPI:
|
|||||||
def get_all_devices(self):
|
def get_all_devices(self):
|
||||||
logger.info(f"Fetching devices from UniFi controller at {self.base_url}")
|
logger.info(f"Fetching devices from UniFi controller at {self.base_url}")
|
||||||
try:
|
try:
|
||||||
url = f"{self.base_url}/proxy/network/integration/v1/sites/{self.site_id}/devices"
|
url = f"{self.base_url}/api/v1/sites/{self.site_id}/devices"
|
||||||
logger.debug(f"Making request to: {url}")
|
logger.debug(f"Making request to: {url}")
|
||||||
logger.debug(f"Using headers: {self.headers}")
|
|
||||||
response = self.session.get(url, headers=self.headers)
|
response = self.session.get(url, headers=self.headers)
|
||||||
response.raise_for_status()
|
response.raise_for_status()
|
||||||
devices = response.json()
|
devices = response.json()
|
||||||
@ -69,7 +68,6 @@ class UnifiAPI:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"Failed to fetch devices: {str(e)}")
|
logger.error(f"Failed to fetch devices: {str(e)}")
|
||||||
return []
|
return []
|
||||||
|
|
||||||
def get_device_details(self, ip_address):
|
def get_device_details(self, ip_address):
|
||||||
logger.debug(f"Looking for device with IP: {ip_address}")
|
logger.debug(f"Looking for device with IP: {ip_address}")
|
||||||
devices = self.get_all_devices()
|
devices = self.get_all_devices()
|
||||||
|
|||||||
Reference in New Issue
Block a user