Skip to content

Latest commit

 

History

History
39 lines (27 loc) · 1.2 KB

README.md

File metadata and controls

39 lines (27 loc) · 1.2 KB

MBTApy

Description

MBTApy is a wrapper around the MBTA-REALTIME API (v2)

Dependencies

See requirements.txt

Documentation

Detailed documentation is not yet available.

Example code to get all upcoming trips for a given mode of transportation:

    import mbtapy
    apiobj = mbtapy.MbtaApi()
    routes = apiobj.get_routes_by_mode("Commuter Rail")
    for route in routes:
        schedules = apiobj.get_schedule_by_route(route)
        print "Route: %s" % route
        print "  Upcoming schedules:"
        for direction in schedules:
            print "  Direction: %s" % direction.direction_name
            for trip in schedules[direction]:
                print "    ", trip.trip_name
                for stop_id, tripstop_obj in trip.stops.items():
                    print "      %s (%s)" % (tripstop_obj.stop_name, tripstop_obj.sch_arr_dt_datetime())

The API specification is available directly from the MBTA.

Licensing and Copyright

MBTApy is licensed under the Apache License v2.0. See included LICENSE for more information.

Copyright© 2015 Joseph W. Dougherty