Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/nikhilweee/path-api

Python API for PATH Trains
https://github.com/nikhilweee/path-api

Last synced: about 1 month ago
JSON representation

Python API for PATH Trains

Awesome Lists containing this project

README

        

# path-api

A python implementation of the PATH API.

Mainly intended to be a replacement for the public API available at
https://www.panynj.gov/bin/portauthority/ridepath.json

# Setup

Install dependencies using your favourite package manager.

```console
$ uv sync
```

# Usage

(One-time setup) Fetch the latest database.

```console
$ python path/db.py
```

Listen to SignalR Hubs for new messages.

```console
$ python listen.py
```

Start a FastAPI server to serve data.

```console
$ fastapi run api.py
```

The latest data should be available at http://localhost:8000/ridepath.json.

# Docker

Spin up containers for the listener and the API server using docker compose.

```
$ docker compose up -d
```

# References

1. Matt Razza's [API](https://github.com/mrazza/path-data) written in C#
1. Matt Razza's
[blog post](https://medium.com/@mrazza/programmatic-path-real-time-arrival-data-5d0884ae1ad6)
on Medium
1. [Public API](https://www.panynj.gov/bin/portauthority/ridepath.json) on
panynj.gov