Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

6 Commits

Repository files navigation

PySocrataClient

Asynchronous Tornado client to Socrata data sources.

A single instance of this class is meant for a single table from a socrata data source, as specified by the constructor's host and view_id parameters.

The instance is used to build the row condition and call the query_rows function on, which asynchronously calls socrata.

Follows Socrata API v1.0, detailed here: http://dev.socrata.com/deprecated/querying-datasets

Requirements:

Future work:

Example:

@tornado.gen.enginedefmain(callback):
# Instantiate a socrata client to# http://data.seattle.gov/Transportation/Street-Parking-Signs/it8u-sznvcl=SocrataClient("data.seattle.gov", "it8u-sznv", None)
# Query to retrieve rows w/ objectid between 0 and 20# that contain the word "Park" in either the "customtext"# or "categoryde" columns.query=cl.AND(
cl.GREATER_THAN(cl.COL("objectid"), cl.VAL(0)),
cl.LESS_THAN(cl.COL("objectid"), cl.VAL(20)),
cl.OR(
cl.CONTAINS(cl.COL("customtext"), cl.VAL("PARK")), cl.CONTAINS(cl.COL("categoryde"), cl.VAL("PARK"))
)
)
rows=yieldtornado.gen.Task(cl.query_rows, query)
printrowscallback()
# Start the IO loop and start the asynchronous requestloop=tornado.ioloop.IOLoop.instance()
main(callback=loop.stop)
loop.start()

About

An asynchronous client for Socrata datasets using Tornado

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages