alfred.py: Make geo attribute setting more robust

rewrite
Jan-Philipp Litza 2014-03-19 23:26:28 +01:00
parent 7075d8481c
commit 89e4c63700
1 changed files with 3 additions and 1 deletions

View File

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