diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2024-10-04 16:18:53 +0200 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2024-10-04 16:18:53 +0200 |
commit | 354fdc648ccee35dc13add60db40ffc67a601d35 (patch) | |
tree | d7367136de1b8affac9d3e70796256ec95702bd5 /scripts | |
parent | b8ab4613bcd88f4110668e803d1e9fbb2fbf556b (diff) | |
download | dotfiles-354fdc648ccee35dc13add60db40ffc67a601d35.tar.gz |
wifionice
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/icewifi.py | 17 |
1 files changed, 13 insertions, 4 deletions
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"] } |