Metro Transit Python SDK
A community-built Python SDK for accessing Metro Transit's NexTrip data.
>>> from metrotransit import Client
>>> from metrotransit.api.nex_trip import get_nextrip_route_id_direction_id_place_code as get_details
>>> client = Client(base_url="https://svc.metrotransit.org")
# Get upcoming trips for the westbound Green Line at East Bank Station
>>> get_details.sync('902', 0, 'EABK', client=client)
NexTripResult(...)Installation
The SDK is available on PyPI.
Install it with your preferred package manager:
$ uv add metrotransit
$ pip install metrotransitThe SDK officially supports Python 3.10+.
Documentation
Every path/method combo in the official spec is represented as a Python module with four functions, and all parameters can be provided with method arguments:
sync: Blocking request that returns parsed data (if successful) orNonesync_detailed: Blocking request that always returns aRequest, optionally withparsedset if the request was successful.asyncio: Likesyncbut async instead of blockingasyncio_detailed: Likesync_detailedbut async instead of blocking
On this page
Languages
Python100.0%
Contributors
MIT License
Created January 7, 2026
Updated January 7, 2026