Skip to main content

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

Project description

Version Python versions Wheel status License

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

Screenshot

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 returns the root element of the XML response using ElementTree.

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.00

License

BSD 3-Clause

Project details


Download files

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

Source Distribution

pybart-1.5.0.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

pybart-1.5.0-py2.py3-none-any.whl (12.7 kB view details)

Uploaded Python 2Python 3

File details

Details for the file pybart-1.5.0.tar.gz.

File metadata

  • Download URL: pybart-1.5.0.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pybart-1.5.0.tar.gz
Algorithm Hash digest
SHA256 7db0c879422282697dc1f44eacfdf3becafd191f1791631e615ce4076cc86e85
MD5 f91a74667d170fc4a0a4a3cbf926b335
BLAKE2b-256 3000cecb7954d3b9294881dec53c9d3357b016d61038ca0b1c38a214c9c09355

See more details on using hashes here.

File details

Details for the file pybart-1.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pybart-1.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1146644e4ff3f7502670e08570ecb570b0419684323846623c5472aa91356393
MD5 74cc9c4df6a8160918d361fef22e6444
BLAKE2b-256 7072ed58dfbbb6ffec94a5ca9acf414fab457f205695dd267f09f0bfbcc1e082

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page