Skip to main content

BART API Wrapper for Python 3+ (w/ JSON)

Bart API Documentation: https://api.bart.gov/docs/overview/index.aspx

Every amenity from the Bay Area Rapid Transit (BART) API is implemented in some way. The methods sections below shows the available methods.

Each API method will return relevant data, usually with new line characters so that when the string is printed, well-formed information is printed. The second branch of this project, BartApiForPrintingInfo, will always print the data.

One exception: the help class methods, which both return data and print it to screen.

Use the help class methods to see what the syntax is for invoking a bart command.

For example, the general help function:

Input

bart = Bart()   # note that key defaults to BART API's universal key
bart.help()

Output

Commands: help, routes, routeinfo 
route_help(), routes(), route_info()

Commands: bsa, count, elev, help 
bsa(), train_count(), elev(), elev_help()

Commands: etd, help 
etd(), etd_help()

Commands: help, stns, stninfo 
stn_help(), stninfo(), stnaccess(), stns()

Commands: arrive, depart, fare, help, holiday, routesched, scheds, special, stnsched 
arrive(), depart(), fare(), sched_help(), holiday(), routesched(), scheds(), special(), stnsched()

Also, there is thorough documentation. The following...

   help(classname.methodname)
   help(classname)

...will give you all of the necessary details about a method or class.

Methods

----- Bart API -----
bart = Bart(key)  # key is optional, defaults to universal BART API key


Advisories
-----------
bsa(orig)
train_count()
elev()
elev_help()


Real-Time Estimates
-------------------
etd(orig, plat, direction)
etd_help()


Route Information
-----------------
routeinfo(route_num, sched_num, date)
routes(sched_num, date)
route_help()


Schedule Information
--------------------
arrive(orig, dest time, b, a)
depart(orig, dest, time, b, a)
fare(orig, dest, date, sched)
holiday()
routesched(route, date, time, sched)
scheds()
special()
stnsched(orig, date)
sched_help()


Station Information
-------------------
stn_help()
stninfo(orig)
stnaccess(orig)
stns()


Version Information
-------------------
version()

Installing

There's a package on PyPI.

pip3 install bart-api-ulloa

Just make sure you have python3 and the requests library (don't even need an API key, since BART has a universal key and it's built into this wrapper).

Metadata

Release files for bart-api-ulloa 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bart-api-ulloa 0.0.2
File Size Uploaded
bart_api_ulloa-0.0.2.tar.gz 6.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for bart-api-ulloa 0.0.2
File Interpreter ABI Platform
bart_api_ulloa-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.3 kB

Release files / bart_api_ulloa-0.0.2.tar.gz

Download URL bart_api_ulloa-0.0.2.tar.gz
Size 6.9 kB
Tags Source
SHA-256 checksum
How to use checksums
369aaa05157d55ee9663dbd1d9c971bca6e960fa9dfa1d5e14e731870e669008
BLAKE2b-256 checksum
How to use checksums
3543e62db710b4118b99f32de35979904281996c283033b6f38670897e63fce2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

Release files / bart_api_ulloa-0.0.2-py3-none-any.whl

Download URL bart_api_ulloa-0.0.2-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a50055941c3b6135d383963f9423eb205ffd72f5c5e5a6811a1513e7f8d84069
BLAKE2b-256 checksum
How to use checksums
0bad0b002a57a8544f612fabb33b38c4b692e8c2157f58c23b7e62f6ad2218ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.0

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page