Softpedia
 


LINUX CATEGORIES:



GLOBAL PAGES >>
NEWS ARCHIVE >>
SOFTPEDIA REVIEWS >>
MEET THE EDITORS >>

WEEK'S BEST

  • BackTrack 5 R1
  • Wine 1.2.3 / 1.4 RC3
  • Mozilla Firefox 10...
  • Ubuntu 11.04
  • Angry Birds 1.1.2.1
  • Ubuntu 10.04.3 LTS
  • Linux Kernel 3.2.6
  • Ubuntu Manual 10.10
  • Adobe Flash Player...
  • Pidgin 2.10.1
  • Home > Linux > Programming > Libraries

    python-openstates 0.5.0

    Download button

    No screenshots available
    Downloads: 120  Tell us about an update
    User Rating:
    Rated by:
    NOT RATED
    0 user(s)
    Developer:

    License / Price:

    Last Updated:

    Category:
    Michael Stephens | More programs
    BSD License / FREE
    February 9th, 2012, 08:57 GMT
    ROOT / Programming / Libraries

     Read user reviews (0)  Refer to a friend  Subscribe

    python-openstates description

    Library for interacting with the Open State Project API

    python-openstates is a Python library for interacting with the Open State Project API.

    The Open State Project provides data on state legislative activities, including bill summaries, votes, sponsorships and state legislator information.

    Source: http://github.com/sunlightlabs/python-openstates

    Installation

    python-opentstates is available on PyPI and so it can most easily be installed via pip install python-openstates or easy_install python-openstates.

    To install from a source distribution, run python setup.py install.

    Usage

    An API key can be obtained at http://services.sunlightlabs.com/.

    Grab state metadata:

     >>> import openstates
     >>> openstates.API_KEY = 'YOUR_API_KEY_HERE'
     >>> ca = openstates.State.get('ca')
     >>> print ca.name
     California
     >>> print ca.lower_chamber_name
     Assembly
     >>> for term in ca.terms:
     ... print term.name
     ... for session in term.sessions:
     ... print "Session: %s" % session
     20092010


    Lookup legislators by name:

     >>> mikes = openstates.Legislator.search(state='ca', first_name='Mike')
     >>> for mike in mikes:
     ... print mike.full_name
     Duvall, Mike D.
     Davis, Mike
     Eng, Mike
     Feuer, Mike


    Lookup legislators by name and party:

     >>> dem_mikes = openstates.Legislator.search(state='ca',
     ... party='Democrat', first_name='Mike')
     >>> for mike in dem_mikes:
     ... print mike.full_name
     Davis, Mike
     Eng, Mike
     Feuer, Mike


    Search bills:

     >>> bills = openstates.Bill.search('agriculture', state='vt')[0:3]
     >>> for bill in bills:
     ... print "%s %s %s" % (bill.state, bill.bill_id, bill.title)
     vt H.0193 AN ACT RELATING TO THE ADDITION OF THE SECRETARY OF AGRICULTURE, FOOD AND MARKETS TO THE BOARD OF TRUSTEES OF THE UNIVERSITY OF VERMONT AND STATE AGRICULTURAL COLLEGE
     vt S.0132 AN ACT RELATING TO AGRICULTURAL FUNDING EDUCATION AND OUTREACH
     vt H.0429 AN ACT RELATING TO A TUITION CREDIT FOR STUDENTS IN AGRICULTURAL PROGRAMS


    Grab information about a specific bill:

     >>> bill = openstates.Bill.get('ca', '20092010', 'lower', 'AB20')
     >>> print bill.title
     An act to add Chapter 14.27 (commencing with Section 67325) to Part 40 of Division 5 of Title 3 of the Education Code, relating to public postsecondary education.


    List a bill's sponsors:

     >>> for sponsor in bill.sponsors:
     ... print sponsor.full_name
     Torlakson, Tom
     Portantino, Anthony
     Block, Marty
     Solorio, Jose


    List a bill's actions:

     >>> for action in bill.actions[0:3]:
     ... print action
     Secretary of State: Chaptered by Secretary of State - Chapter 402, Statutes of 2009.
     Governor: Approved by the Governor.
     Governor: Enrolled and to the Governor at 5 p.m.


    View a bill's votes:

     >>> vote = bill.votes[0]
     >>> print vote.motion
     Do pass as amended and be re-referred to the Committee on Business and Professions.
     >>> print vote.yes_count, vote.no_count, vote.other_count
     9 0 0


    Lookup legislators by latitude and longitude:

     >>> legislators = openstates.Legislator.geo(-73.675451, 42.737498)
     >>> print legislators[0].full_name
     Roy J. McDonald



    Product's homepage

    Requirements:

    · Python
    · remoteobjects

      


    TAGS:

    Open State Project | Python library | Open State | API | library



    HTML code for linking to this page:


    Go to top

    WindowsGamesDriversMacLinuxScriptsMobileHandheldNews

    SUBMIT PROGRAM   |   ADVERTISE   |   GET HELP   |   SEND US FEEDBACK   |   RSS FEEDS   |   UPDATE YOUR SOFTWARE   |   ROMANIAN FORUM