alfred.py: Make geo attribute setting more robust

This commit is contained in:
Jan-Philipp Litza 2014-03-19 23:26:28 +01:00
parent 7075d8481c
commit 89e4c63700

View file

@ -15,8 +15,10 @@ class alfred:
for key in node:
node_alias[key] = node[key]
if 'location' in node:
try:
node_alias['geo'] = [node['location']['latitude'], node['location']['longitude']]
except (TypeError, KeyError):
pass
try:
node_alias['id'] = node['network']['mac']