From 354fdc648ccee35dc13add60db40ffc67a601d35 Mon Sep 17 00:00:00 2001 From: Jonas Gunz Date: Fri, 4 Oct 2024 16:18:53 +0200 Subject: wifionice --- scripts/icewifi.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/icewifi.py b/scripts/icewifi.py index 9286c0c..4fb0b79 100755 --- a/scripts/icewifi.py +++ b/scripts/icewifi.py @@ -3,16 +3,25 @@ import requests import json -data = requests.get("https://iceportal.de/api1/rs/status") +TRIPINFO = "https://iceportal.de/api1/rs/tripInfo/trip" +STATUS = "https://iceportal.de/api1/rs/status" + +data = requests.get(STATUS) +trip = requests.get(TRIPINFO) if data.status_code != 200: - print(f"HTTP Status {data.status_code}") + print(f"Data HTTP Status {data.status_code}") +if trip.status_code != 200: + print(f"Trip HTTP Status {data.status_code}") t_info = data.json() +t_trip = trip.json() + +future_stops = [ e for e in t_trip['trip']['stops'] if not e['info']['passed'] ] return_info={ - 'text':t_info["tzn"], - 'tooltip':f'BR{t_info["series"]}, I-Netz {t_info["internet"]}', + 'text':f"{t_trip['trip']['trainType']} {t_trip['trip']['vzn']}", + 'tooltip':f'BR{t_info["series"]}({t_info["tzn"]}), I-Netz {t_info["connectivity"]["currentState"]}', #'class':'', 'percentage':t_info["speed"] } -- cgit v1.2.3