diff options
author | Daniel Friesel <derf@finalrewind.org> | 2021-04-02 10:53:50 +0200 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2021-04-02 10:53:50 +0200 |
commit | 5153717dbd124464a06f439f81d9dcd0dde4cd94 (patch) | |
tree | c020573bb39d6e09de29226cf3ba32656f65424c | |
parent | b5955549ccbdd71c42b6ef621a6d87ded2972ad4 (diff) |
handle trains without line number
-rwxr-xr-x | bin/lookup-server | 6 |
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"]) |