Compare commits

...

3 Commits

Author SHA1 Message Date
Josiah Baldwin
5947e48c5b modified node parsing to accept ony number of nested strings 2025-06-14 12:42:59 -07:00
Daan Selen
31a8f00cd0 syntax fix 2025-06-12 16:58:19 +02:00
Daan Selen
871d36b334 Added support for new MeshCentral response type.
2b4ab2b122
2025-06-12 16:35:08 +02:00

View File

@@ -478,7 +478,18 @@ class Session(object):
if "result" in res0:
raise exceptions.ServerError(res0["result"])
if details:
nodes = json.loads(res0["data"])
try:
nodes = res0["data"]
# Accept any number of nested strings, meshcentral is odd
while True:
try:
nodes = json.loads(nodes)
except TypeError:
break
except Exception as e:
print(f"Failed to parse device data: {e}")
return
for node in nodes:
if node["node"].get("meshid", None):
node["node"]["mesh"] = mesh.Mesh(node["node"].get("meshid"), self)
@@ -1969,4 +1980,4 @@ class _FileExplorerWrapper:
return await self._files.__aenter__()
async def __aexit__(self, exc_t, exc_v, exc_tb):
return await self._files.__aexit__(exc_t, exc_v, exc_tb)
return await self._files.__aexit__(exc_t, exc_v, exc_tb)