All Projects → CityOfNewYork → Open311-Inquiry

CityOfNewYork / Open311-Inquiry

Licence: other
www.nyc.gov/developer

Programming Languages

python
139335 projects - #7 most used programming language

Open311-Inquiry

Open311 is a form of technology that provides open channels of communication for issues that concern public space and public services. Primarily, Open311 refers to a standardized protocol for location-based collaborative issue-tracking. Open311 provides access to Services, Facilities, and Frequently Asked Questions (FAQs). Open311 also provides the 311 Today feed which provides daily status messages regarding Public Schools, Alternate Side Parking, and Garbage/Recycling pick up. Important City announcements based on current events may also be provided through this feed.

Import The Library

To use the included Python Library, you must first import it:
import open311SNSL

If the library fails to import, make sure python is set to search the directory that the file is located in. Then restart python and try again.

Creating ServiceList Object

Creating a open311 ServiceList object and setting the API Key/ID:
ServListObj = open311SNSL.servicelist('API ID' , 'API Key')

Changing the API Key or ID for a servicelist object that was already created:
ServListObj.setID('NewID')
ServLisObj.setKey('NewKey')

Getting the API Key or ID for a DOT object that was already created:
ServListObj.getID()
ServListObj.getKey()

Using an already created object, search for "all" service lists and format as a JSON or XML
serviceListOutput = ServListObj.getServiceList(ServListObj.s_all , ServListObj.json)
OR
serviceListOutputServListObj.getServiceList(ServListObj.s_all , ServListObj.xml)

To output the result in text format:
print serviceListOutput.text

Creating an open311 Service Object:


Creating a open311 Servic object and setting the API Key/ID and Service ID:
serviceObject = open311SNSL.service('API ID' , 'API Key' , 'service_id')
Get specific service information and output as a JSON or XML
serviceInfo = serviceObject.getService(serviceObject.xml)
OR
serviceInfo = serviceObject.getService(serviceObject.json)

To output the result in text format:
print serviceInfo.text

For further documentation and examples, see the integrated help Doc in python:
help(open311SNSL)

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].