Skip to content

departures_by_location

Alex Jung edited this page Jan 1, 2025 · 1 revision

Find all departures for a specific location

Arguments

Arguments Type Required Description
stop Location | str required Location for which the departures are being sought
limit int optional Max size of returned list. Default value is 40
date str optional Date/time for which the departures are sought in format "YYYYMMDD hh:mm", "YYYYMMDD" or "mm:hh". Default value is empty

Return value

Type Description
list[Departure] List of departures sorted by departure time

Examples

from apyefa import EfaClient, Departure

async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
    departures: list[Departure] = await client.departures_by_location("de:09564:704", limit=3, date="22:13")

    print(f"Found {len(departures)} departure(s)")
    print(location[0].line_name)
    print(location[0].route)
    print(location[0].transport)
    print(location[0].planned_time)
    # OUTPUT:
    # Found 3 departure(s)
    # U3
    # Nordwestring - Hauptbahnhof - Plärrer - Großreuth bei Schweinau
    # <TransportType.SUBWAY: 2>
    # datetime.datetime(2024, 12, 7, 22, 16, tzinfo=zoneinfo.ZoneInfo(key='Europe/Berlin'))