/pywmata

A Python interface to the WMATA API

Primary LanguagePythonMIT LicenseMIT

WMATA

WMATA is an easy to use Python interface to the Washington Metropolitan Area Transit Authority API.

Contents

Requirements

  • Python 3.8

Installation

pip install wmata

Usage

Getting Started

from wmata import MetroRail, Station

client = MetroRail(api_key)

trains = client.next_trains(Station["A01"])

Design

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

MetroRail

Provides access to all MetroRail related endpoints.

Using MetroRail
import wmata

client = wmata.MetroRail(api_key)

trains = client.next_trains(wmata.Station["A01"])

MetroBus

Provides access to all MetroBus related endpoints.

Using MetroBus
from wmata import MetroBus

client = MetroBus(api_key)

routes = client.routes()

Testing

Run

python setup.py test

Tests use VCRpy to avoid network requests.

Dependencies

  • Requests

Dev Dependencies

  • VCRpy

Contact

Feel free to email questions and comments to emma@emma.sh

License

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