-
Notifications
You must be signed in to change notification settings - Fork 3
Examples
Cameron edited this page Jan 7, 2025
·
11 revisions
For different example data, head over to the main branch on the repository and head to the /examples folder. In this folder, you'll be able to find a whole range of example code you can run and play with to your heart's desire.
A few examples are provided here:
# Import the package
from realtime_trains_py import RealtimeTrainsPy
# Configure the package
rtt = RealtimeTrainsPy(
username = "<your_username>"
password = "<your_password>"
complexity = "a.p"
)
rtt.get_departures(tiploc = "KNGX")# Import the package
from realtime_trains_py import RealtimeTrainsPy
# Configure the package
rtt = RealtimeTrainsPy(
username = "<your_username>"
password = "<your_password>"
complexity = "s.n"
)
arrivals = rtt.get_arrivals(tiploc = "LEEDS", date = "2025/01/10")
for arrival in arrivals:
print(f"{arrival.service_uid} | {arrival.gbtt_arrival} | {arrival.origin} to {arrival.terminus}")All of our data is kindly provided by Realtime Trains.