Skip to content

AttributeError: 'TrainChanges' object has no attribute 'arrival' #11

@HumanBot000

Description

@HumanBot000
def fetch_timetable_changes(times: list[datetime]):
    station = station_helper.find_stations_by_name("Leipzig-Wahren")[0]
    timetable_helper = table_helper.TimetableHelper(station, api)
    trains_to_fetch = []
    for time in times:
        for train in timetable_helper.get_timetable(time.hour):
            if f"{train.train_type}{train.train_line}" != "S3":
                continue
            if train.arrival != time.strftime("%y%m%d%H%M"):
                continue
            trains_to_fetch.append(train)
    change_timetable = timetable_helper.get_timetable_changes(trains_to_fetch)
    late_trains = []
    for index, change in enumerate(change_timetable):
        if change.train_changes.arrival != change.arrival:
            late_trains.append({
                "train": change,
                "planned_arrival": change.arrival,
                "actual_arrival": change.train_changes.arrival
            })
    return late_trains

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions