A CLI Python program showing arrival timetables, service information, & ADA access for NYC Subway stations.
- MTA API key
req-lib.txtstop.txttransfers.txtstations.csvprotobuf-to-dict-update.py(might be optional, see below)subway_time.py- python 3.x or above
pip install -r requirements.txt --userIt takes a tiny bit of prep. work, but it's otherwise very easy to use (& understand):
- Get an API key
- Install the modules/packages/libraries
- (OPTIONAL, depending on whether the library is giving you trouble)
Replace protobuf3-to-dict package code with that ofprotobuf-to-dict-fix.py(found in the requirements folder above). The only difference between the two is the latter changes alllongtoint;nyc-subway-time.pycannot run without the package, & the package cannot run in python 3 and above whilelongexists
If you're having trouble finding where your packages are, try running
pip show protobuf3-to-dictor alternatively, try running the following in a Python file to get the folder pathname:
import site
print(site.getsitepackages())- Get source code (i.e.
subway_time.py) and static files (found in requirements folder); be sure to keep everything in the same working dir/folder - Add API key to src code (i.e. line 17: API_KEY)
- Run
Has fuzzy autocomplete for station name search:
And also has an option for default settings to save your preferred station. To reset, enter -r or --reset as a CLI argument.
Will tell you of upcoming service announcements as well as current ones:
It's written to be (reasonably) robust when used in good faith 💪
-j--json: Keep JSON train info and service alert feeds-r--reset: Removes/resets user defaults (kept inconfig.json)-s--service: Show full service alert after each timetable
python subway-time.py -r -s- LIRR and/or MetroNorth
- MTA buses
- NJ PATH
Other Python realtime subway lookups; very helpful to me while researching & building this project! :D