Skip to content

lines_by_name

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

Find lines by name.

Arguments

Arguments Type Required Description
name str required Name of the line to search. e.g. U1 or 67

Return value

Type Description
list[Line] List of lines found for provided name

NOTE: The attribute origin of returned line objects is None

Examples

async with EfaClient("https://efa.vgn.de/vgnExt_oeffi/") as client:
    lines: list[Line] = await client.lines_by_name("U1")

    print(f"Found {len(lines)} line(s)")
    print(f"id         : {lines[0].id}")
    print(f"name       : {lines[0].name}")
    print(f"description: {lines[0].description}")
    print(f"product    : {lines[0].product}")

    # OUTPUT:
    # Found 4 line(s)
    # id         : vgn:11001: :H:j24
    # name       : U1
    # description: Fürth Hardhöhe - Nürnberg Plärrer - Hauptbahnhof - Langwasser Süd
    # product    : <TransportType.SUBWAY: 2>