summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2012-11-01 16:33:57 +0100
committerFlorian Bruhin <git@the-compiler.org>2012-11-01 16:33:57 +0100
commitb765e599dab2b2d6c1c47b69266ef377ba3ffc0d (patch)
tree3bcb3f2096b2cbd102f5cf2127bd914181e370bb
parente40d6d4f8206f9ffdb0dd9b4abbccf66a87e5261 (diff)
downloadsbb_distance-master.tar.gz
sbb_distance-master.zip
catch KeyError for loc_idHEADmaster
-rw-r--r--pytransportapi.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pytransportapi.py b/pytransportapi.py
index 823f98c..71f3d27 100644
--- a/pytransportapi.py
+++ b/pytransportapi.py
@@ -47,7 +47,10 @@ class Location:
'100'
"""
# The id of the location
- self.loc_id = j['id']
+ try:
+ self.loc_id = j['id']
+ except KeyError:
+ self.loc_id = None
# Type of the location, can contain:
# * station: Location is a train station, bus station
# * poi: Location is a point of interest (Clock tower, China garden)