From 97f87cc9ccf7b888c4c71797f43e087bfa22cae5 Mon Sep 17 00:00:00 2001 From: JuliusFreudenberger Date: Wed, 16 Oct 2019 12:37:56 +0200 Subject: [PATCH] Fixed error handling for unknown stations --- bot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bot.py b/bot.py index e72fe66..468024f 100644 --- a/bot.py +++ b/bot.py @@ -43,7 +43,7 @@ def start(update): def search_station(query): request = requests.get("https://efa-api.asw.io/api/v1/station/?search=" + query) - if request.status_code != 200 and len(request.text) > 2: + if request.status_code != 200 or (request.status_code == 200 and len(request.text) <= 2): return -1 else: return request.json()[0]['stationId']