cumtd-python

An unnoficial Python client for the CUMTD REST API.


License
MIT
Install
pip install cumtd-python==1.0.0

Documentation

cumtd-python

An unofficial Python client for the CUMTD REST API. Skip making HTTP requests to the website endpoints and download this easy-to-use package instead!

Disclaimer: This project and I have no association with CUMTD and its partners.

Benefits

  • A simple to use Python wrapper for public CUMTD API endpoints.
  • In less than 10 minutes, you can start pulling CUMTD data such as routes, timings, stop information and more.
  • You don't have to worry about handling the nuances of the official API --> easy to use methods for every endpoint

Development

  • Current Version: 1.0.0
  • This package is tested with private and public tests, but may still have some bugs.
  • Implementation of methods with "optional" parameters coming soon (look at CUMTD API for details).
  • If you encounter any bugs or problems, submit an "Issue" to this repository and I will fix it as soon as possible.
  • Any open-source contribution is appreciated!

Getting Started

Now available on PyPi!

Simply install the package with:

pip install cumtd-python

Usage

This API attempts to present a clean interface to the CUMTD API, but in order to use it to its full potential, you must familiarize yourself with the official CUMTD API documentation.

To use the CUMTD API, you need to first acquire an instant API key here.

With this API Key, declare an api object:

import cumtd
api = cumtd.ApiClient(<api-key>)

Now you can make calls using api to retrieve the necessary data.

Methods

Calendar

api.get_calendar_dates_by_date('2017-05-06')
api.get_calendar_dates_by_service("1N SHOW")

Departures

api.get_departures_by_stop("it")

Reroutes

api.get_reroutes()
api.get_reroutes_by_route("green")

Routes

api.get_route("teal")
api.get_routes()
api.get_routes_by_stop("it")

Shapes

api.get_shape("7E NO EDGE")
api.get_shape_between_stops("IT:1","WRTHLY:4","7E NO EDGE")

Stops

api.get_stop("it")
api.get_stops()
api.get_stops_by_lat_lon("40.1133", "-88.226")
api.get_stops_by_search("wright")

Stop Times

api.get_stop_times_by_trip("[@14.0.51617008@][3][1275939436250]/12__O1")
api.get_stop_times_by_stop("it")

Planned Trips

api.get_planned_trips_by_lat_lon("40.12233", "-88.29619", "40.11626", "88.25783")
api.get_planned_trips_by_stops("unipspct", "dncncltn")

Trips

api.get_trip("[@14.0.51617008@][3][1275939436250]/12__O1")
api.get_trips_by_block("O3")
api.get_trips_by_route("yellow")

Vehicles

api.get_vehicle("1352")
api.get_vehicles()
api.get_vehicles_by_route("teal)

Other

api.get_news()
api.get_api_usage()