Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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 import Alerts

at = Alerts(key=YOUR_API_KEY_HERE)

# Find all alerts affecting Alewife
alerts = at.get(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 filters.

Alerts affecting Orange and Red lines

alerts = at.get(route=['Orange', 'Red'])

Alerts affecting parking or Wheelchair use

alerts = at.get(activity=['PARK_CAR', 'USING_WHEELCHAIR'])

Include other data

Return the stop data along with routes

from pymbta3 import Routes

rt = Routes(key=YOUR_API_KEY_HERE)

# Find all Route data for the Red Line
routes = rt.get(route='Red', include='stops')

API Methods Implented

  • Alerts
  • Routes
  • Stops
  • Vehicles
  • Predictions
  • Schedules
  • Trips
  • Facilities

Metadata

Release files for pymbta3 0.0.5.dev0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymbta3 0.0.5.dev0
File Size Uploaded
pymbta3-0.0.5.dev0.tar.gz 5.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymbta3 0.0.5.dev0
File Interpreter ABI Platform
pymbta3-0.0.5.dev0-py3-none-any.whl Python 3 none any Details

Total release size: 11.4 kB

Release files / pymbta3-0.0.5.dev0.tar.gz

Download URL pymbta3-0.0.5.dev0.tar.gz
Size 5.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4e75d07a540bb783af51cf029f970cd0044df08ca93fba327a0adc4aa7a00e5d
BLAKE2b-256 checksum
How to use checksums
b69c7d40c065b18b8d8d264ccca913af91f254bc5d3799d92654730b9ec5b7bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6

Release files / pymbta3-0.0.5.dev0-py3-none-any.whl

Download URL pymbta3-0.0.5.dev0-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcb3a2b57d0d762fc6a47cb7d5e090cdd1100dba87746dc1e0b5d8a33e73f594
BLAKE2b-256 checksum
How to use checksums
1723ab561ade9d377786973c1558a5d5e04bad271063ecce778e065137c01f5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.10.6
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page