Skip to content

Commit

Permalink
api/me: mlat uuid can be list or str
Browse files Browse the repository at this point in the history
  • Loading branch information
iakat committed Aug 31, 2024
1 parent 6eac990 commit 3cf7d17
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/adsb_api/utils/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,12 +274,18 @@ def mlat_clients_to_list(self, ip=None):
clients_list.append(
{key: client[key] for key in keys_to_copy if key in client}
)
# for uuid, special handle because it's a list,
# we get first element if it's there, otherwise set it to None
# for uuid, special handle because it's a list OR a string.
try:
clients_list[-1]["uuid"] = (
client["uuid"][0][:13] + "-..." if client["uuid"] else None
)
if isinstance(client["uuid"], list):
clients_list[-1]["uuid"] = (
client["uuid"][0][:13] + "-..." if client["uuid"] else None
)
elif isinstance(client["uuid"], str):
clients_list[-1]["uuid"] = (
client["uuid"][:13] + "-..." if client["uuid"] else None
)
else:
clients_list[-1]["uuid"] = None
except:
clients_list[-1]["uuid"] = None
return clients_list
Expand Down

0 comments on commit 3cf7d17

Please sign in to comment.