summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2021-04-02 10:53:50 +0200
committerDaniel Friesel <derf@finalrewind.org>2021-04-02 10:53:50 +0200
commit5153717dbd124464a06f439f81d9dcd0dde4cd94 (patch)
treec020573bb39d6e09de29226cf3ba32656f65424c
parentb5955549ccbdd71c42b6ef621a6d87ded2972ad4 (diff)
handle trains without line number
-rwxr-xr-xbin/lookup-server6
1 files changed, 5 insertions, 1 deletions
diff --git a/bin/lookup-server b/bin/lookup-server
index ea19880..183db48 100755
--- a/bin/lookup-server
+++ b/bin/lookup-server
@@ -36,7 +36,11 @@ class Train:
def __init__(self, train):
self.stopovers = train["previousStopovers"]
self.tripId = train["tripId"]
- self.train_type, self.line_no = train["line"]["name"].split()
+ try:
+ self.train_type, self.line_no = train["line"]["name"].split()
+ except ValueError:
+ self.train_type = train["line"]["name"]
+ self.line_no = ""
self.train_no = train["line"]["fahrtNr"]
self.request_eva = int(train["stop"]["id"])