Skip to main content

An API wrapper for Iowa City's bus data

Project description

Bongo
=====

A simple API wrapper for the [Iowa City bus data
API](http://www.ebongo.org/api/) -- mainly to use as an example for an
upcoming blog post.


Installation
------------

You can install the API wrapper using [`pip`](http://pypi.python.org/pypi/pip).

pip install bongo


Usage
-----

There are two ways of interacting with the Bongo API.

The first way is just interacting with the `bongo` module.

```python
>>> import bongo

>>> bongo.routes()
{"routes": [1234, 5678, 9999]}

>>> bongo.route('lantern', 'coralville')
{"coralville's": {"lantern": "route"}}

>>> bongo.stops()
{"stops": [1234, 5678, 9999]}

>>> bongo.stop(8350)
{"stop": {"8350": "information"}}

>>> bongo.predict(8350)
{"stop": {"8350": "predictions"}}
```

The second way is interacting with the `Bongo` class.

```python
>>> from bongo import Bongo
>>> b = Bongo()

>>> # List of all Bongo routes.
>>> b.routes()
{"routes": [1234, 5678, 9999]}

>>> # Info for a specific route and agency.
>>> b.route('lantern', 'coralville')
{"coralville's": {"lantern": "route"}}

>>> # List of all stops.
>>> b.stops()
{"stops": [1234, 5678, 9999]}

>>> # Information for a specific stop.
>>> b.stop(8350)
{"stop": {"8350": "information"}}

>>> # Predict the arrival times at a specific stop.
>>> b.predict(8350)
{"stop": {"8350": "predictions"}}

>>> # Bongo can also be used to return XML data.
>>> Bongo('xml').routes()
<ohai><xml><data></data></xml></ohai>
```


Copyright
---------

Copyright (c) 2012 Code for America. See [LICENSE][] for details.

[license]: https://github.com/codeforamerica/bongo/blob/master/LICENSE.mkd

[![Code for America Tracker](http://stats.codeforamerica.org/codeforamerica/cfa_template.png)][tracker]

[tracker]: http://stats.codeforamerica.org/projects/bongo

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

bongo-0.2.1.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file bongo-0.2.1.tar.gz.

File metadata

  • Download URL: bongo-0.2.1.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bongo-0.2.1.tar.gz
Algorithm Hash digest
SHA256 386dac0d9223131d17496d7760eedfc8cafd3153774681e283cc97b149f6d9f8
MD5 6223fdd220359ed0bff3e26e296b2f27
BLAKE2b-256 05dc5bda8f86494a61614f06a58586ffadc47365e21bf940344839ba61d4c671

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