Skip to main content

No project description provided

Project description

pymbta3

Python wrapper for the MBTA v3 API

Install

pip install pymbta3

Usage

To get data from the MBTA API, import the library and call the object with your API key. The API Key may also be stored in the environment variable MBTA_API_KEY.

from pymbta3.alerts import Alerts

at = Alerts(key=YOUR_API_KEY_HERE)

# Find all alerts affecting the Red Line at Alewife
alerts = at.get_alert(route='Red', stop='place-alfcl')

# Find the short header for the alert
for alert in alerts['data']:
    print(alert['attributes']['short_header'])

Multiple values can be passed in for most lists.

# Alerts affecting Orange and Red lines
alerts = at.get_alert(route=['Orange', 'Red'])
# find all alerts affecting parking or Wheelchair use
alerts = at.get_alert(activity=['PARK_CAR', 'USING_WHEELCHAIR'])

Project details


Download files

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

Files for pymbta3, version 0.0.1.dev0
Filename, size File type Python version Upload date Hashes
Filename, size pymbta3-0.0.1.dev0-py2.py3-none-any.whl (5.2 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page