Skip to main content

bart api wrapper in python, now returns data instead of just printing

Project description

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

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

bart_api_ulloa-0.0.2.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

bart_api_ulloa-0.0.2-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file bart_api_ulloa-0.0.2.tar.gz.

File metadata

  • Download URL: bart_api_ulloa-0.0.2.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for bart_api_ulloa-0.0.2.tar.gz
Algorithm Hash digest
SHA256 369aaa05157d55ee9663dbd1d9c971bca6e960fa9dfa1d5e14e731870e669008
MD5 018f4ae2bf836e749e4b8c31c04c6ad7
BLAKE2b-256 3543e62db710b4118b99f32de35979904281996c283033b6f38670897e63fce2

See more details on using hashes here.

File details

Details for the file bart_api_ulloa-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: bart_api_ulloa-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for bart_api_ulloa-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a50055941c3b6135d383963f9423eb205ffd72f5c5e5a6811a1513e7f8d84069
MD5 0f54d28697c284834b757c9ac4fe14e5
BLAKE2b-256 0bad0b002a57a8544f612fabb33b38c4b692e8c2157f58c23b7e62f6ad2218ef

See more details on using hashes here.

Supported by

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