Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Real time BART (Bay Area Rapid Transit) information in your terminal!

Project Description

Real time BART (Bay Area Rapid Transit) information in your terminal!

Features

  • Real time estimates and service advisories
  • Curses-based TUI with auto-refreshing and resizing
  • View multiple stations at the same time
  • Colors indicating transit lines, estimate times, and train lengths
  • Ability to configure a default set of stations
  • Other non-TUI commands like opening a map and getting the fare for a trip
  • Includes a low-level Python wrapper for the full BART API
  • No dependencies; built with only standard libraries

Requirements

  • Python 2.6+ or Python 3.0+ with the curses module installed (i.e. not Windows)
  • Terminal with 256 color support to correctly display the Richmond-Fremont line as orange (magenta otherwise)
    • Note: this usually involves setting the TERM environment variable to xterm-256color

Installation

pip install pybart

Usage

usage: bart [-h] [-v] {map,list,est,fare} ...

Display real time BART estimates.

optional arguments:
  -h, --help           show this help message and exit
  -v, --version        show program's version number and exit

commands:
  {map,list,est,fare}
    map                open station map in web browser
    list               show list of stations and their abbreviations
    est                display estimates for specified stations
    fare               show fare for a trip between two stations

examples:
  bart                 get estimates for $BART_STATIONS
  bart map             open station map
  bart list            list all stations
  bart est mcar        get estimates for MacArthur station
  bart est embr cols   get estimates for Embarcadero and Coliseum stations
  bart fare conc sfia  get fare for a trip between Concord and SFO stations

Configuration

The following (optional) environment variables can be used to configure pybart:

  • BART_STATIONS - a comma-separated string (e.g. mcar,embr,cols) specifying the default stations to use when running bart with no arguments.
  • BART_API_KEY - the BART API key to use when fetching information. A public one is used by default, but you can get your own here.

API

Even though it doesn’t use everything, pybart includes a low-level Python wrapper for the full BART API with pybart.api.BART. Every call by default returns the root element of the XML response using ElementTree. JSON is also supported but the format is currently in beta.

Example usage:

>>> from pybart.api import BART
>>> bart = BART()  # Uses the public API key by default
>>> root = bart.stn.stninfo('dbrk')
>>> station = root.find('stations').find('station')
>>> print(station.find('address').text + ', ' + station.find('city').text)
2160 Shattuck Avenue, Berkeley
>>> print(bart.version().find('apiVersion').text)
3.10
>>> bart = BART(json_format=True)  # Now with JSON
>>> root = bart.stn.stninfo('dbrk')
>>> station = root['stations']['station']
>>> print(station['address'] + ', ' + station['city'])
2160 Shattuck Avenue, Berkeley

License

BSD 3-Clause

Release History

Release History

This version
History Node

1.5.1

History Node

1.5.0

History Node

1.4.0

History Node

1.3.1

History Node

1.3.0

History Node

1.2.2

History Node

1.2.1

History Node

1.2.0

History Node

1.1.0

History Node

1.0.2

History Node

1.0.1

History Node

1.0.0

Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
pybart-1.5.1-py2.py3-none-any.whl (13.1 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Aug 15, 2017
pybart-1.5.1.tar.gz (8.9 kB) Copy SHA256 Checksum SHA256 Source Aug 15, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting