Skip to content

Commit

Permalink
Fix: MeshDB response format change causes crash (#109)
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew-Dickinson authored Sep 19, 2024
1 parent ba4309e commit df0c5fc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mesh-database-client/mesh_database_client/meshdb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def _member_id_to_nn(self, member_id):
# If there are multiple active installs for this member, arbitrary select the first one
install = install_query_json["results"][0]

if not install["network_number"]:
if not install["node"]["network_number"]:
return None

return install["network_number"]
return install["node"]["network_number"]

def name_to_nn(self, name):
member_query_response = self.requests_sesssion.get(
Expand Down Expand Up @@ -90,9 +90,9 @@ def get_nn(self, input_number):
install_num_query_response.raise_for_status()
install_num_query_json = install_num_query_response.json()

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

return None
except requests.exceptions.RequestException:
Expand Down

0 comments on commit df0c5fc

Please sign in to comment.