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

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.4.dev0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymbta3-0.0.4.dev0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymbta3-0.0.4.dev0.tar.gz
  • Upload date:
  • Size: 5.2 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.4.dev0.tar.gz
Algorithm Hash digest
SHA256 e0bf80f16b4c1b4005c528679db59b86b819eb54f887b10d87c7c4c7e35cb5a3
MD5 e77f02cb66a47c3d55d11784637549f0
BLAKE2b-256 02bc16cf65710b5a14403d950cd912d4e45a6389d47d154e6f47a80f137ae52a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymbta3-0.0.4.dev0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.6

File hashes

Hashes for pymbta3-0.0.4.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 243ac310c41ce80b39fadd84b29daeea73fb32e061a66f1033237324e7677b79
MD5 8c1688911d9843337a58dedad3b4cecf
BLAKE2b-256 4de07c15b07f0bb33e86cdcf2ebd3ae6b67860c8460738560de34e9d7e5c0050

See more details on using hashes here.

Supported by

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