Fork Me on GitHub

Three

An easy-to-use Python wrapper for the Open311 API.

Download this project as a .zip file Download this project as a tar.gz file

At A Glance

Three was made to make the differences in Open311 GeoReport server implementations completely unknown to the end user. Interacting with service requests should be easy.

>>> import three

>>> three.cities()
['boston', 'macon', 'new haven', 'sf', ... ]

# Let's start off with Macon.
>>> three.city('macon')

>>> three.key('my_macon_api_key')

>>> three.discovery()
{'service': {'discovery': 'data'}}

>>> three.services()
{'macon': {'service': 'data'}}

>>> three.services('033')
{'033': {'service_code': 'info'}}

>>> three.requests()
{'macon': {'request': 'data'}}

>>> three.requests('123')
{'123': {'request': 'data'}}


# Now, let's switch it up to San Francisco.
>>> three.city('sf')

>>> three.key('my_sf_api_key')

>>> three.services()
{'SF': {'service': 'data'}}

>>> three.requests()
{'SF': {'request': 'data'}}


# And, finally Baltimore.
>>> three.city('baltimore')

>>> three.key('baltimore_api_key')

>>> three.services()
{'baltimore': {'service': 'data'}}

>>> three.requests()
{'baltimore': {'request': 'data'}}

For casual users, working with the three module should feel effortless. Any pain points (such as dealing with XML, required parameters, etc.) should be abstracted away.

>>> import three

>>> three.city('macon')

# Let's grab requests between certain dates.
>>> three.requests(start='03-10-2012', end='03-17-2012')

# But, let's use the between parameter.
>>> three.requests(between=['03-10-2012', '03-17-2012'])

# All the requests! (Currently 83...)
>>> three.requests(between=['03-10-2012', '03-17-2012'], count=100)

Installation

This is still a work in progress, but you can git clone this repo and run python setup.py install to check out the current progress.

Alternatively, you can install via pip.

pip install three