import asyncio from sncf.sncf import SNCF, PhysicalModes async def main(): sncf = SNCF("5722269b-2e58-49ee-986b-21741438d5ff") # instanciate SNCF client with auth token sncf.set_physical_mode(PhysicalModes.Train) # set prefered mode (others can be Autocar, LongDistanceTrain (TGV), ...) for stop in await sncf.get_station("Benfeld"): print(stop.name, stop.id) print("Available physical modes: ", [mode.value for mode in stop.physical_modes]) print("----------------") sncf.set_source_stop_point("stop_point:SNCF:87214056") # Sélestat sncf.set_dest_stop_point("stop_point:SNCF:87212027") # Strasbourg sncf.max_transfers = 2 sncf.max_duration_secs = 20 * 60 next_journeys = await sncf.get_next_journeys(max_count=5) for next_journey in next_journeys: print("(D)", next_journey.departure_date_time, "-", "(A)", next_journey.arrival_date_time, "- Transfers:", next_journey.nb_transfers, "- Duration:", next_journey.duration, "seconds" ) if __name__ == '__main__': asyncio.run(main())