From f7879ee8cc3b43ab0bd776e1407c4fa67855b34d Mon Sep 17 00:00:00 2001 From: Lucas Cimon <925560+Lucas-C@users.noreply.github.com> Date: Tue, 15 Nov 2022 19:01:06 +0100 Subject: [PATCH] Fix KeyError: 'journeys' I also had to patch some dependencies versions in order to install `locomotive` without raising errors: ``` pip install markupsafe==2.0.1 'regex<2022.3.15' ``` --- locomotive/api/oui_v3.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/locomotive/api/oui_v3.py b/locomotive/api/oui_v3.py index 3416ac5..4c6b6de 100644 --- a/locomotive/api/oui_v3.py +++ b/locomotive/api/oui_v3.py @@ -60,7 +60,7 @@ def request(self, json: dict) -> Any: self.logger.debug(res.request.body) self.logger.debug(res.content) - if res.status_code == 404: + if res.status_code == 404 or "error" in res.json(): # {"code":"ERR-0102","label":"empty travel result"} return {"journeys": []}