From 871d36b334d8a7f586d2c25da5a865555a0af537 Mon Sep 17 00:00:00 2001 From: Daan Selen Date: Thu, 12 Jun 2025 16:35:08 +0200 Subject: [PATCH] Added support for new MeshCentral response type. https://github.com/Ylianst/MeshCentral/commit/2b4ab2b1226061e62616e6cb2421cd3ea84290ae --- src/meshctrl/session.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/meshctrl/session.py b/src/meshctrl/session.py index 52d2a51..46b9568 100644 --- a/src/meshctrl/session.py +++ b/src/meshctrl/session.py @@ -479,6 +479,16 @@ class Session(object): raise exceptions.ServerError(res0["result"]) if details: nodes = json.loads(res0["data"]) + try: + raw_data = res0["data"] + if isinstance(raw_data, str): + nodes = json.loads(raw_data) + else: + nodes = raw_data + 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 +1979,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) \ No newline at end of file + return await self._files.__aexit__(exc_t, exc_v, exc_tb)