Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: MeshDB response format change causes crash #109

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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