hafas-fumbling/main.py
2026-03-23 11:48:45 +01:00

23 lines
617 B
Python

import datetime
from typing import List
from pyhafas import HafasClient
from pyhafas.profile import IVBProfile
from pyhafas.types.fptf import Leg
client = HafasClient(IVBProfile())
locations = client.locations("Anichstraße")
best_found_location = locations[0]
print(best_found_location)
print("======================================")
departures = client.departures(
station=best_found_location,
date=datetime.datetime.now(),
max_trips=1
)
print(departures)
print(len(departures), type(departures))
print("======================================")
for leg in departures:
print(f"Name: {leg.name}")