From 89e4c6370050a012bc5ce09a9a1c798f2656e527 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Wed, 19 Mar 2014 23:26:28 +0100 Subject: [PATCH] alfred.py: Make geo attribute setting more robust --- alfred.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/alfred.py b/alfred.py index b8aa1e2..06ee1f7 100755 --- a/alfred.py +++ b/alfred.py @@ -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']