Tracks all MBTA buses and subway trains
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
static
templates
.gitattributes
.gitignore
Dockerfile
README.md
api_routes.py
bustracker.py
currentdata.py
datacollection.py
dictChecker.py
dictmaker.py
docker-compose.yml
flaskbus.py
requirements.txt
setup.sh

README.md

Public instance running at MBTA.fyi

Set up the environment

We use Conda to manage our Python libraries. Install conda

Note that if you choose to install Anaconda (the full version), you probably only need to install GTSF Realtime. But if you choose to install Miniconda, which is way smaller, you'll need to install dependencies later one by one.

Dependencies

GTFS Realtime

install GTFS

pip install protobuf
pip install --upgrade gtfs-realtime-bindings

If it's throwing errors about setuptools, do this:

conda install -c https://conda.anaconda.org/anaconda setuptools

If it's still not working, try install GTFS using

easy_install --upgrade gtfs-realtime-bindings

Flask

flask-assets

Using the pyScss and Flask Assets to compile the SCSS files.

pip install flask-assets
pip install pyScss

lxml

conda install lxml

Get an API key

Sign up for an account on the MBTA realtime Developer Portal and create a new application. It may take a day or two to get approval. Once you get it, create a file called ignore/mbta_api_key.txt and paste your API key there.

Run the App

$ git clone "https://github.com/robsideshow/mbta-bustracker.git"
$ cd your-path-to/mbta-bustracker
$ python flaskbus.py

Open the app at localhost:5000/

API References

MBTA Realtime and GTFS Documentation

NextBus Documentation