wmataio
is an easy to use Python interface to the Washington Metropolitan Area Transit Authority API (Washington, DC Public Transit).
- Python 3.10
pip install wmataio
from wmataio import MetroRail, Station
client = MetroRail(api_key)
await client.load_data()
stations: dict[str, Station] = client.stations
lines: dict[str, Line] = client.lines
wmataio
breaks the WMATA API into two components: MetroRail
and MetroBus
.
Provides access to all MetroRail related endpoints.
import wmataio
client = wmataio.client(api_key)
trains = await client.rail.next_trains_at_station(client.rail.stations["A01"])
Provides access to all MetroBus related endpoints.
import wmataio
client = wmataio.client(api_key)
routes = await client.bus.get_all_routes()
Thanks to @emma-k-alexandra for pywmata which I used as the base for this repo.
wmataio
is released under the MIT license. See LICENSE for details.