Fix API response handling for list vs dict
This commit is contained in:
1 parent
0142b0e93b
commit
44b6662507
1 file changed
+4
-1
@@ -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