Skip to main content

A simple async interface to the WMATA (Washington, DC Public Transit) API

Project description

wmataio

wmataio is an easy to use Python interface to the Washington Metropolitan Area Transit Authority API (Washington, DC Public Transit).

Contents

Requirements

  • Python 3.10

Installation

pip install wmataio

Usage

Getting Started

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

Design

wmataio breaks the WMATA API into two components: MetroRail and MetroBus.

MetroRail

Provides access to all MetroRail related endpoints.

Using MetroRail
import wmataio

client = wmataio.client(api_key)

trains = await client.rail.next_trains_at_station(client.rail.stations["A01"])

MetroBus

Provides access to all MetroBus related endpoints.

Using MetroBus
import wmataio

client = wmataio.client(api_key)

routes = await client.bus.get_all_routes()

Credits

Thanks to @emma-k-alexandra for pywmata which I used as the base for this repo.

License

wmataio is released under the MIT license. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pywmataio-0.0.8.tar.gz (23.1 kB view hashes)

Uploaded Source

Built Distribution

pywmataio-0.0.8-py3-none-any.whl (37.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page