Easily get arrival times of 91 terminal locations of WMATA Metro Rail in command line.
A python executable that returns Washington Metropolitan Area Transit Authority(WMATA) train arrival times.
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.
wmata_api_key
- get this from wmata developer websitetablefmt
- 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.
Default tier sufficient for most casual developers. Rate limited to 10 calls/second and 50,000 calls per day
To make your script executable, add the script’s path to your .bash_profile.
open -e .bash_profile
this opens your .bash_profile in your TextEdit app.
Add the path at the end of .bash_profile. Here’s mine:
Restart your terminal.
Add this at the top of script:
#!/usr/bin/env python
Change the script to an executable:
chmod +x [your python script]
Run the script in terminal using just the filename.