Logo

Easily get arrival times of 91 terminal locations of WMATA Metro Rail in command line.

View the Project

WMATA Metro Train Arrivals

metro art

A python executable that returns Washington Metropolitan Area Transit Authority(WMATA) train arrival times.

demo

View the source code

Download the project

View next train arrivals from WMATA


Note that you have to create a config.py file.

There are two variables that are imported from this file.

config.py
  1. wmata_api_key - get this from wmata developer website
  2. tablefmt - select from: ‘pretty’, ‘grid’, ‘simple’, ‘fancy_grid’ or take a look at tabulate website for supported table styles. I think the four above work well.

The WMATA developer website provides a free API.

wmata developer website

Default tier sufficient for most casual developers. Rate limited to 10 calls/second and 50,000 calls per day


Steps to run python scripts like any terminal commands.

To make your script executable, add the script’s path to your .bash_profile.

  1. open -e .bash_profile this opens your .bash_profile in your TextEdit app.

  2. Add the path at the end of .bash_profile. Here’s mine:

  1. Restart your terminal.

  2. Add this at the top of script: #!/usr/bin/env python

  3. Change the script to an executable: chmod +x [your python script]

  4. Run the script in terminal using just the filename.