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

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.3.dev0.tar.gz (4.4 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.3.dev0-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymbta3-0.0.3.dev0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for pymbta3-0.0.3.dev0.tar.gz
Algorithm Hash digest
SHA256 19907bf6ebeb0318bcdba402a5cf5531fe5718c3cfdafac09e4651f00967c6b1
MD5 67d84c26fa0401bf2d481d42ad22d131
BLAKE2b-256 bb3ce3a7e2c7823209c048e0b3f4e50a00a5ee4dbd007ad78fc7fb79a418b146

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymbta3-0.0.3.dev0-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.0

File hashes

Hashes for pymbta3-0.0.3.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a26f794d212421e4e58f77ca39694a28d990df85de89fd5c09a4205073a4939
MD5 6fc54e8ef29da577366d6cd4f8f423a6
BLAKE2b-256 acc677ac024343350342c01d6fd8f446ce09f744d5c28c7e4af821c26f613495

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