mirror of
https://github.com/kaaninchen/Gleiswechsel.git
synced 2026-07-21 11:43:30 +00:00
Fehler beim Überprüfen der Vollständigkeit von den API behoben
This commit is contained in:
@@ -26,7 +26,7 @@ OPERATORS = {
|
||||
"slogan": ["Senk ju vor träwelling wis Deutsche Bahn.", "Bitte beachten Sie die umgekehrte Wagenreihung.", "Zurückbleiben bitte!", "Alle reden vom Wetter. Wir nicht.", "Die Bahn macht mobil.", "Grün abgefahren"]
|
||||
},
|
||||
"db_bawü": {
|
||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/d/d1/Bwegt_Logo_%282020%29.jpg",
|
||||
"logo": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/4f/Bwegt_Logo.svg/960px-Bwegt_Logo.svg.png",
|
||||
"color": 0xFFBF34,
|
||||
"slogan": ["Nett hier", "Aber waren Sie schon mal in Baden-Württemberg?", "Bwegt euch!"]
|
||||
},
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ async def rename_vc(bot: discord.Bot):
|
||||
train_ID = current['train_number']
|
||||
|
||||
train_info = get_train_info(station=current['station'], train_ID=train_ID, train_type=train_type)
|
||||
if train_info['operators'] and train_info['arrival']:
|
||||
if train_info and train_info.get('operators') and train_info.get('arrival'):
|
||||
break
|
||||
|
||||
logger(f"Versuch {attempt}: Keine Ankunftszeit für {current['train']} verfügbar, versuche neue Verbindung...")
|
||||
|
||||
+11
-1
@@ -68,7 +68,17 @@ def get_train_info(station, train_ID, train_type):
|
||||
return None
|
||||
|
||||
dep = data.get("departure", [])
|
||||
arrival_iso = dep.get("route_post_diff", [])[-1].get("sched_arr")
|
||||
if not dep:
|
||||
return None
|
||||
|
||||
route_post = dep.get("route_post_diff")
|
||||
if not route_post:
|
||||
return None
|
||||
|
||||
arrival_iso = route_post[-1].get("sched_arr")
|
||||
if not arrival_iso:
|
||||
return None
|
||||
|
||||
return {
|
||||
"arrival": arrival_iso,
|
||||
"operators": dep.get("operators"),
|
||||
|
||||
Reference in New Issue
Block a user