Python helper library for accessing MTA subway data
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Python helper library for accessing NYC MTA subway data


To output all Subway routes and a list of all stops for each route from the command line, simply invoke:

$ ./

The results of this data (collected 14 October 2014) are stored in stops_per_subway_line.txt.

Parser library usage:

>>> from parser import get_routes
>>> routes = get_routes()
>>> routes['F']
{'agency_id': 'MTA NYCT',
 'route_color': 'FF6319',
 'route_desc': 'Trains operate at all times between Jamaica, Queens, and Stillwell Av, Brooklyn via the 63 St Connector (serving 21 St-Queensbridge, Roosevelt Island, Lexington Av-63 St, and 57 St-6 Av). F trains operate express along Queens Blvd at all times. Trains do not serve Queens Plaza, 23 St-Ely Av, Lexington Av-53 St and 5 Av-53 St.',
 'route_id': 'F',
 'route_long_name': 'Queens Blvd Express/ 6 Av Local',
 'route_short_name': 'F',
 'route_text_color': '',
 'route_type': '1',
 'route_url': ''}
>>> routes.keys()


This library was written in accordance with the Agreement for Access to Metropolitan Transportation Authority ("MTA") Data Feeds and anyone who wishes to modify this library should do so within the terms of the agreement.

Sample data in the google_transit directory was downloaded from via on 14 October 2014.


The original motivation was to get a list of subway stations per line, essentially answering this post: