Permalink
Fetching contributors…
Cannot retrieve contributors at this time
121 lines (80 sloc) 3.32 KB

sunlight.openstates

This is a thin wrapper around the Open States API, which provides data on state legislators, bills, votes, committees, districts, events, and more!

Please consider contributing to the Open States project, it's all open-source, and community involvement is valued very much by the Open States crew.

Note

If you come across data quality issues, broken code, or missing data, please file a report on the GitHub issues page. Thanks!

Metadata

Methods for dealing with Open States Metadata.

Bills

Methods for dealing with Open States Bills.

Legislators

Methods for dealing with Open States Legislators.

Committees

Methods for dealing with Open States Committees.

Districts

Methods for dealing with Open States Districts.

Events

Methods for dealing with Open States Events.

Examples

Bills:

from sunlight import openstates

vt_agro_bills = openstates.bills(
    q='agriculture',
    state='vt',
    chamber='upper'
)

for bill in vt_agro_bills:
    print bill['title']

Legislators:

from sunlight import openstates

ca_dems = openstates.legislators(
    state='ca',
    party='Democratic',
    first_name='Bob',
    active='true'
)

for dem in ca_dems:
    print "%s %s (%s)" % (
        dem['first_name'], dem['last_name'], dem['chamber'] )

Committees:

from sunlight import openstates

md_cttys = openstates.committees( state='md', chamber='upper' )
for ctty in md_cttys:
    print "%s (%s)" % ( ctty['committee'], ctty['chamber'] )

Events:

from sunlight import openstates

tx_events = openstates.events( state='tx', type='committee:meeting' )
for event in tx_events:
    print "Event @ %s" % event['when']
    for who in event['participants']:
        print "  %s (%s)" % ( who['participant'], who['chamber'] )