Thanks to visit codestin.com
Credit goes to github.com

Skip to content

otherfutures/nyc-subway-time

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nyc-subway-time

Short Description

A CLI Python program showing arrival timetables, service information, & ADA access for NYC Subway stations.

screenshot

Requirements

  • MTA API key
  • req-lib.txt
  • stop.txt
  • transfers.txt
  • stations.csv
  • protobuf-to-dict-update.py(might be optional, see below)
  • subway_time.py
  • python 3.x or above

Install modules from req-lib.txt

pip install -r requirements.txt --user

Long Description

It takes a tiny bit of prep. work, but it's otherwise very easy to use (& understand):

  1. Get an API key
  2. Install the modules/packages/libraries
  3. (OPTIONAL, depending on whether the library is giving you trouble)
    Replace protobuf3-to-dict package code with that of protobuf-to-dict-fix.py (found in the requirements folder above). The only difference between the two is the latter changes all long to int; nyc-subway-time.py cannot run without the package, & the package cannot run in python 3 and above while long exists

    If you're having trouble finding where your packages are, try running
pip show protobuf3-to-dict

or alternatively, try running the following in a Python file to get the folder pathname:

import site
print(site.getsitepackages())
  1. 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
  2. Add API key to src code (i.e. line 17: API_KEY)
  3. Run

Has fuzzy autocomplete for station name search:

union sq search
union sq 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:

servicealerts

It's written to be (reasonably) robust when used in good faith 💪

CLI Arguments

  • -j --json: Keep JSON train info and service alert feeds
  • -r --reset: Removes/resets user defaults (kept in config.json)
  • -s --service: Show full service alert after each timetable

Example usage:

python subway-time.py -r -s

(Possible) Future Updates

  • LIRR and/or MetroNorth
  • MTA buses
  • NJ PATH

See Also

Other Python realtime subway lookups; very helpful to me while researching & building this project! :D

About

Realtime CLI arrival times, service information, & ADA access for the NYC Subway

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages