An open API service indexing awesome lists of open source software.

https://github.com/alifeee/train-tracking

Tracking live trains
https://github.com/alifeee/train-tracking

opentraintimes python train-tracking

Last synced: about 1 year ago
JSON representation

Tracking live trains

Awesome Lists containing this project

README

          

# Train tracking

Using to get train headcodes.

Using to get trains from those headcodes.

## Requirements

- Python 3

## Setup

```bash
python -m venv env
pip install -r requirements.txt
```

## Run

### Find train

`not implemented`

### Find headcode

```bash
> python headcode.py

Found 4 results

Result 1: https://live.rail-record.co.uk/train/?c=W33810&d=2024-03-12
Departure time: d. 1148
From: Manchester Piccadilly
To: Sheffield
Operator: Northern
2S80 d. 1148Manchester Piccadilly Sheffield https://live.rail-record.co.uk/train/?c=W33810&d=2024-03-12

...
```

...or...

```python
from headcode import Train, get_trains

HEADCODE = "5Z39"

trains = get_trains(headcode)
for train in trains:
train.pprint()
```