Fix API response handling for list vs dict
This commit is contained in:
@@ -54,7 +54,10 @@ class OPNsenseDeviceManager:
|
|||||||
devices = []
|
devices = []
|
||||||
seen_macs = set()
|
seen_macs = set()
|
||||||
|
|
||||||
for entry in result.get('data', []):
|
# Handle both list and dict responses
|
||||||
|
entries = result if isinstance(result, list) else result.get('data', [])
|
||||||
|
|
||||||
|
for entry in entries:
|
||||||
mac = entry.get('mac', '')
|
mac = entry.get('mac', '')
|
||||||
ip = entry.get('ip', '')
|
ip = entry.get('ip', '')
|
||||||
manufacturer = entry.get('manufacturer', 'Unknown')
|
manufacturer = entry.get('manufacturer', 'Unknown')
|
||||||
|
|||||||
Reference in New Issue
Block a user