OpenBusAPI documentation

This contains the documentation for the OpenBusAPI project

OpenBusAPI

Python GitHub uv Polars Pytest Flask PythonAnywhere GitHub Actions CI Build Codecov Coverage Read the Docs Documentation Status Buy Me A Coffee License: MIT No AI

OpenBusAPI is the backend interface for the BusTracker App. It provides a gateway API to access transport location data from the Bus Open Data Service API. The API also provides an endpoint to download data on transport operators taken from the NOC Database.

Hosting the API

Hosting the API requires a key for the backend location API, which can be obtained above. The code searches for an environment variable OPEN_BUS_API_KEY or a plain text file api_key in the parent directory.

The API uses the Flask framework, in order to run the interface, I recommend the fantastic uv package manager, which can be used to run the API directly with:

  uv run open_bus_api

Dependencies

API

The Open Bus API provides the following endpoints:

Endpoint

Description

/

The index page

/version

Returns the current version of the API

/location/area/min_latitude/min_longitude/max_latitude/max_longitude

Location data on vehicles within the area provided

/location/vehicle/vehicle_id

Location data on the vehicle with id vehicle_id

/operators/data

Fetch the vehicle operator database in JSON format

/operators/info/list

Provides a summary of the data fields in the operator database

/stops/area/min_latitude/min_longitude/max_latitude/max_longitude

Data on transport stops within the area provided

Indices and tables