Skip to content

Commit df0c5fc

Browse files
Fix: MeshDB response format change causes crash (#109)
1 parent ba4309e commit df0c5fc

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

mesh-database-client/mesh_database_client/meshdb_client.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ def _member_id_to_nn(self, member_id):
3030
# If there are multiple active installs for this member, arbitrary select the first one
3131
install = install_query_json["results"][0]
3232

33-
if not install["network_number"]:
33+
if not install["node"]["network_number"]:
3434
return None
3535

36-
return install["network_number"]
36+
return install["node"]["network_number"]
3737

3838
def name_to_nn(self, name):
3939
member_query_response = self.requests_sesssion.get(
@@ -90,9 +90,9 @@ def get_nn(self, input_number):
9090
install_num_query_response.raise_for_status()
9191
install_num_query_json = install_num_query_response.json()
9292

93-
if install_num_query_json["status"] == "Active":
93+
if install_num_query_json["status"] == "Active" and install_num_query_json["node"]:
9494
# We found an install for this as an install number, translate that to an NN
95-
return install_num_query_json["network_number"]
95+
return install_num_query_json["node"]["network_number"]
9696

9797
return None
9898
except requests.exceptions.RequestException:

0 commit comments

Comments
 (0)