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

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

pymbta3-0.0.5.dev0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

pymbta3-0.0.5.dev0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file pymbta3-0.0.5.dev0.tar.gz.

File metadata

  • Download URL: pymbta3-0.0.5.dev0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for pymbta3-0.0.5.dev0.tar.gz
Algorithm Hash digest
SHA256 4e75d07a540bb783af51cf029f970cd0044df08ca93fba327a0adc4aa7a00e5d
MD5 2200962b216b484ac1c4ed30a31826b2
BLAKE2b-256 b69c7d40c065b18b8d8d264ccca913af91f254bc5d3799d92654730b9ec5b7bf

See more details on using hashes here.

File details

Details for the file pymbta3-0.0.5.dev0-py3-none-any.whl.

File metadata

File hashes

Hashes for pymbta3-0.0.5.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 dcb3a2b57d0d762fc6a47cb7d5e090cdd1100dba87746dc1e0b5d8a33e73f594
MD5 5f723d6cd41deffce3e1b9a4f71cbb6d
BLAKE2b-256 1723ab561ade9d377786973c1558a5d5e04bad271063ecce778e065137c01f5b

See more details on using hashes here.

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