Fixed error handling for unknown stations

This commit is contained in:
JuliusFreudenberger 2019-10-16 12:37:56 +02:00
parent b23a86cd90
commit 97f87cc9cc

2
bot.py
View file

@ -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']