cristobers / TrainTimeFinder

Python script that prints the train arrival and departure times from the Transport For Wales API.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Train Time Finder For TFW Services

What is this?

This is a python script that uses Transport For Wales' API to get train arrival and departure times.

How do I use this?

python3 trainTimes.py <origin> <destination> <time> <date>

trainTimes.py also serves as an example as to how the library is used.

Attribute Type
origin str
destination str
time str
date str

NOTE: both time and date are subject to change in the future, mostly date, which is likely to change to datetime.

Examples

>>> import station
>>> station = station.Departures("GBCDF", "GBQQM", "2023-10-10", "12:00")
>>> station
<station.Departures object at 0x7f296cd40b50>

Station returns a station.Departures object. station.legs returns the departures from GBCDF to GBQQM.

>>> station.legs
[{'sequence': '0', 'travelSegmentID': 'LS_1_0_TS_0', 'type': 'TRAIN', 'originTravelPoint': 
{'origin': 'GBCDF', 'type': 'STATION'}, 'destinationTravelPoint': 
{'origin': 'GBQQM', 'type': 'STATION'}, 'departureDateTime': '2023-10-10T11:53:00', 
'arrivalDateTime': '2023-10-10T15:15:00', ...
>>>

Why did you make this?

At the time of writing this (almost two years ago) the Transport For Wales app was VERY slow, as such, this was a lot faster if all I was doing was remembering when my train was supposed to depart.

About

Python script that prints the train arrival and departure times from the Transport For Wales API.

License:GNU General Public License v3.0


Languages

Language:Python 100.0%