Skip to main content

Python API Wrapper for the Realtime Trains API

Project description

Realtime Trains API Python Module


Maintained and managed by anonymous44401

PyPI License Issues Downloads

Quick links

Latest release

Pre-releases

Documentation

Repository

About this package

realtime-trains-py is an open-source python API Wrapper designed to allow you to access data directly from the Realtime Trains API, in a simple and user-friendly way. This package includes three different complexity modes that allow you to customise how you want to see the data provided by the API.

This package can be used for anything railway related. Whether you're a rail enthusiast or commuter, this package can be used for all your purposes. The package can be used in personal applications or for personal rail data access. For commercial use, you should contact Realtime Trains. More information can be found on their API home page

This package is not affiliated with Realtime Trains.

What can I do with this package?

This package allows you to access data directly from the Realtime Trains API using one of three complexities. Each complexity mode gives you access to different data the API offers.

For the most flexibility, you can use simple mode, the recommended mode. Simple mode allows you to access a fair amount of the data available from the Realtime Trains API. This mode is recommended for those that want a manageable amount of information while keeping it easy to read. Use complexity="simple".

Using simple mode, you can optionally select between prettier or normal mode. The default, prettier mode, gives you your data in a nicely formatted table, while normal mode gives you your data as objects, so you'll need to get the data out of the objects yourself. To use normal mode, use complexity="simple_normal". Don't worry though! If you're confused, we have plenty of documentation to help you out.

For the most freedom with the API, you can use complex mode. Complex mode lets you access all the data available from the Realtime Trains API. This mode does not format any data for you - it creates new .json files with the data you requested. This mode is recommended for those who have a good understanding of python and managing json files. Use complexity="complex".

Installation Instructions

To install the package, simply run the following command in your terminal:

$ pip install realtime-trains-py

Alternatively, you can clone, fork or download the repository onto your device.

Once installed, you can import the package. Place the lines below in your file or you can run them directly in your terminal.

from realtime_trains_py import RealtimeTrainsPy

rtt = RealtimeTrainsPy(
    request_token="<your_request_token>", 
    complexity="<your_choice>"
)

Check out our full setup guide for more help setting up.

You'll need an account for the Realtime Trains API to use this package. You can sign up for free at the API home page.

Examples

Get Live

The example below will display a live departure board for Ely.
rtt.get_live(tiploc="ELYY")

Get Departures

The example below will return up to 15 rows on the departure board for London King's Cross at the time you run the program.
rtt.get_departures(tiploc="KNGX", rows=15)

Get Service

The example below will return the service information of G28171 at the time you run the program.
rtt.get_service(service_uid="G28171")

More in-depth examples can be found on our examples page.

Licensing

The realtime-trains-py API Wrapper uses an MIT License.

All data is kindly provided by Realtime Trains through the Realtime Trains API. This package is not affiliated with Realtime Trains.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

realtime_trains_py-2027.1.2.tar.gz (23.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

realtime_trains_py-2027.1.2-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file realtime_trains_py-2027.1.2.tar.gz.

File metadata

  • Download URL: realtime_trains_py-2027.1.2.tar.gz
  • Upload date:
  • Size: 23.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for realtime_trains_py-2027.1.2.tar.gz
Algorithm Hash digest
SHA256 7931ffa7eb0fc0cb14919e435afc405bc3edb0d4006d864628376efe65087db5
MD5 77eef16f7758ec23c816ff3b8ca9fef7
BLAKE2b-256 702e501aaef66ec86ee1f6d160a3d59ba32cd0bee0851f899c03fac9db44de6f

See more details on using hashes here.

File details

Details for the file realtime_trains_py-2027.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for realtime_trains_py-2027.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 91004fa09f82ed08376c56ab5d5f5055fdc98f54c6cf004958f265e4390dfd24
MD5 c84c4337c7e6311a79b22107a81be681
BLAKE2b-256 5b2d0dd1b66e9201811922d10162e36a7935eb7341b5e6971fe4d8b55db1516b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page