{ "info": { "author": "James Turk", "author_email": "jturk@sunlightfoundation.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "==================\npython-sunlightapi\n==================\n\n.. warning::\n This library is deprecated in favor of the more comprehensive `python-sunlight `_.\n\n\nPython library for interacting with the Sunlight Labs API.\n\nThe Sunlight Labs API provides legislator information and district lookups.\n\n(http://services.sunlightlabs.com/api/)\n\npython-sunlightapi is a project of Sunlight Labs (c) 2010.\nWritten by James Turk .\n\nAll code is under a BSD-style license, see LICENSE for details.\n\nHomepage: http://pypi.python.org/pypi/python-sunlightapi/\n\nSource: http://github.com/sunlightlabs/python-sunlightapi/\n\nThe package can be installed via pip, easy_install or by downloading the\nsource and running ``python setup.py install``.\n\nRequirements\n============\n\npython >= 2.4\n\nsimplejson >= 1.8 (not required with python 2.6, will use built in json module)\n\nUsage\n=====\n\nTo initialize the api, all that is required is for it to be imported and for an\nAPI key to be defined.\n\n(If you do not have an API key visit http://services.sunlightlabs.com/api/ to\nregister for one.)\n\nImport ``sunlight`` from ``sunlightapi``:\n \n >>> from sunlightapi import sunlight, SunlightApiError\n \nAnd set your API key:\n \n >>> sunlight.apikey = 'your-key-here'\n\n-------------------\nlegislators methods\n-------------------\n\nThe legislators namespace is comprised of several functions:\n * legislators.get - get a single legislator\n * legislators.getList - get zero or more legislators\n * legislators.search - fuzzy search for legislators by name\n * legislators.allForZip - get all legislators representing a zipcode\n * legislators.allForLatLong - get all legislators representing a point\n\n\nget and getList\n---------------\n \nlegislators.get and legislators.getList both take any number of parameters and\nreturn all legislators that match the provided criteria. These parameters are\nalso the ones returned in each legislator object. \n\nThe available parameters are:\n * title\n * firstname\n * middlename\n * lastname\n * name_suffix\n * nickname\n * party\n * state\n * district\n * in_office\n * gender\n * birthdate\n * phone\n * fax\n * website\n * webform\n * email\n * congress_office\n * bioguide_id\n * votesmart_id\n * fec_id\n * govtrack_id\n * crp_id\n * eventful_id\n * congresspedia_url\n * twitter_id\n * official_rss\n * youtube_url\n * senate_class\n * birthdate\n\n\nTo get the representative that represents NC-4:\n\n >>> print(sunlight.legislators.get(state='NC', district='4'))\n Rep. David Price (D-NC)\n \nlegislators.getList works much the same way, but returns a list. It is\npossible to do a more complex query, for instance\n\"all legislators from New York that are Republicans\":\n\n >>> for leg in sunlight.legislators.getList(state='NY', party='R'):\n ... print(leg)\n Rep. Pete King (R-NY)\n Rep. Christopher Lee (R-NY)\n\n\n**It is preferred that you do not call getList without parameters as it will\npull down all legislators, if you need to do this feel free to grab the provided\ndump of the API data available at http://services.sunlightlabs.com/api/**\n\n\nsearch\n------\n\nlegislators.search allows you to query the database with a less than perfect\nrepresentation of a legislator's name.\n\nThe search is tolerant of use of nicknames, lastname-firstname juxtaposition,\ninitials and minor misspellings. The return is a set of results that include\nlegislator records as well as certainity scores between 0 and 1 (where 1 is\nmost certain).\n\nSearch takes two optional parameters\n\n``threshold``\n the minimum score you want to return, the default is 0.8 and you should rarely go lower than 0.7.\n``all_legislators``\n if True will search legislators in the API that are no longer in office (default is False)\n\nAn example usage of search is as follows:\n\n >>> for r in sunlight.legislators.search('Diane Finestine'):\n ... print(r)\n 0.92125 Sen. Dianne Feinstein (D-CA)\n\n \nIt is also possible to get multiple results:\n \n >>> for r in sunlight.legislators.search('Frank'):\n ... print(r)\n 1.0 Rep. Barney Frank (D-MA)\n 0.972222222222 Rep. Trent Franks (R-AZ)\n 0.952380952381 Sen. Al Franken (D-MN)\n\n\nallForZip\n---------\n\nlegislators.allForZip retrieves all legislators that represent a given zipcode.\n\nThis typically means two senators and one (or more) representatives.\n\nTo get all legislators that represent the 27511 zipcode:\n \n >>> for legislator in sunlight.legislators.allForZip(27511):\n ... print(legislator)\n Rep. David Price (D-NC)\n Sen. Kay Hagan (D-NC)\n Sen. Richard Burr (R-NC)\n Rep. Brad Miller (D-NC)\n\n\nallForLatLong\n-------------\n\nlegislators.allForLatLong retrieves all legislators representing a given point.\n\nThis is a shortcut for calling districts.getDistrictFromLatLong and then\nlooking up the district representative and state senators.\n\nTo get all legislators that represent a location in western PA at 41.92, -80.14:\n \n >>> for legislator in sunlight.legislators.allForLatLong(41.92, -80.14):\n ... print(legislator)\n Sen. Bob Casey (D-PA)\n Sen. Arlen Specter (D-PA)\n Rep. Kathy Dahlkemper (D-PA)\n\n\n-----------------\ndistricts methods\n-----------------\n\nThe districts namespace is comprised of two functions:\n * districts.getDistrictsFromZip\n * districts.getDistrictFromLatLong\n\n\ngetDistrictsFromZip\n-------------------\n\ndistricts.getDistrictsFromZip fetches all districts that overlap a given\nzipcode.\n\nTo get all districts that overlap 14623:\n >>> for district in sunlight.districts.getDistrictsFromZip(14623):\n ... print(district)\n NY-29\n NY-28\n\n\ngetDistrictFromLatLong\n----------------------\n\ndistricts.getDistrictFromLatLong finds the district that a given lat-long\ncoordinate pair falls within.\n\nTo find out what district 61.13 N, 149.54 W falls within:\n >>> print(sunlight.districts.getDistrictFromLatLong(61.13, 149.54))\n AK-0\n\nThis point is in fact in Anchorage, Alaska, so this is correct.\n\n\n-----------------\ncommittee methods\n-----------------\n\nThe committee namespace contains:\n * committee.getList\n * committee.get\n * committee.allForMember\n\ngetList\n-------\n\ncommittee.getList gets all committees for a given chamber (House, Senate, or Joint).\n\nTo see all joint committees for the current congress:\n >>> for c in sunlight.committees.getList('Joint'):\n ... print(c)\n Joint Economic Committee\n Joint Committee on Printing\n Joint Committee on Taxation\n Joint Committee on the Library\n\nget\n---\n\ncommittee.get gets full details for a given committee, including membership and subcommittees.\n\nExample of getting details for a committee:\n\n >>> com = sunlight.committees.get('HSAG')\n >>> print(com.name)\n House Committee on Agriculture\n >>> for sc in com.subcommittees:\n ... print(sc)\n Subcommittee on Conservation, Credit, Energy, and Research\n Subcommittee on Department Operations, Oversight, Nutrition and Forestry\n Subcommittee on General Farm Commodities and Risk Management\n Subcommittee on Horticulture and Organic Agriculture\n Subcommittee on Livestock, Dairy, and Poultry \n Subcommittee on Rural Development, Biotechnology, Specialty Crops, and Foreign Agriculture\n >>> for m in com.members:\n ... print(m)\n Rep. Joe Baca (D-CA)\n Rep. John Boccieri (D-OH)\n Rep. Leonard Boswell (D-IA)\n Rep. Bobby Bright (D-AL)\n Rep. Dennis Cardoza (D-CA)\n Rep. Bill Cassidy (R-LA)\n Rep. Travis Childers (D-MS)\n Rep. Mike Conaway (R-TX)\n Rep. Jim Costa (D-CA)\n Rep. Henry Cuellar (D-TX)\n Rep. Kathy Dahlkemper (D-PA)\n Rep. Brad Ellsworth (D-IN)\n Rep. Jeff Fortenberry (R-NE)\n Rep. Bob Goodlatte (R-VA)\n Rep. Sam Graves (R-MO)\n Rep. Debbie Halvorson (D-IL)\n Rep. Stephanie Herseth Sandlin (D-SD)\n Rep. Tim Holden (D-PA)\n Rep. Tim Johnson (R-IL)\n Rep. Steven Kagen (D-WI)\n Rep. Steve King (R-IA)\n Rep. Larry Kissell (D-NC)\n Rep. Frank Kratovil (D-MD)\n Rep. Bob Latta (R-OH)\n Rep. Frank Lucas (R-OK)\n Rep. Blaine Luetkemeyer (R-MO)\n Rep. Cynthia Lummis (R-WY)\n Rep. Betsy Markey (D-CO)\n Rep. Jim Marshall (D-GA)\n Rep. Eric Massa (D-NY)\n Rep. Mike McIntyre (D-NC)\n Rep. Walt Minnick (D-ID)\n Rep. Jerry Moran (R-KS)\n Rep. Randy Neugebauer (R-TX)\n Rep. Collin Peterson (D-MN)\n Rep. Earl Pomeroy (D-ND)\n Rep. Phil Roe (R-TN)\n Rep. Mike Rogers (R-AL)\n Rep. Mark Schauer (D-MI)\n Rep. Jean Schmidt (R-OH)\n Rep. Kurt Schrader (D-OR)\n Rep. David Scott (D-GA)\n Rep. Adrian Smith (R-NE)\n Rep. G.T. Thompson (R-PA)\n Rep. Tim Walz (D-MN)\n\nallForLegislator\n----------------\n\nAll for legislator shows all of a legislator's committee and subcommittee memberships.\n\n*note that the subcommittees included are only the subcommittees that the member has a seat on*\n\nShowing all of a legislators committees and subcommittees:\n >>> for com in sunlight.committees.allForLegislator('S000148'):\n ... print(com)\n ... for sc in com.subcommittees:\n ... print(' '+str(sc))\n Senate Committee on Rules and Administration\n Senate Committee on Finance\n Subcommittee on International Trade and Global Competitiveness\n Subcommittee on Social Security, Pensions and Family Policy\n Subcommittee on Taxation, IRS Oversight, and Long-term Growth\n Joint Committee on the Library\n Joint Economic Committee\n Senate Commmittee on the Judiciary\n Subcommittee on Administrative Oversight and the Courts\n Subcommittee on Antitrust, Competition Policy and Consumer Rights\n Subcommittee on Crime and Drugs\n Subcommittee on Immigration, Refugees and Border Security\n Subcommittee on Terrorism and Homeland Security\n Joint Committee on Printing\n Senate Committee on Banking, Housing, and Urban Affairs\n Subcommittee on Securities, Insurance, and Investment\n Subcommittee on Financial Institutions\n Subcommittee on Housing, Transportation, and Community Development", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/sunlightlabs/python-sunlightapi/", "keywords": null, "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "python-sunlightapi", "package_url": "https://pypi.org/project/python-sunlightapi/", "platform": "any", "project_url": "https://pypi.org/project/python-sunlightapi/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/sunlightlabs/python-sunlightapi/" }, "release_url": "https://pypi.org/project/python-sunlightapi/1.1.1/", "requires_dist": null, "requires_python": null, "summary": "Library for interacting with the Sunlight Labs API", "version": "1.1.1" }, "last_serial": 2120801, "releases": { "0.2.0": [ { "comment_text": "", "digests": { "md5": "f2af79cc074e65601f48a32c2fe7ea31", "sha256": "4d35c0854176a8933afa197cf6bb6e61210197520ee2132b0721423c49361b13" }, "downloads": -1, "filename": "python-sunlightapi-0.2.0.tar.gz", "has_sig": false, "md5_digest": "f2af79cc074e65601f48a32c2fe7ea31", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7071, "upload_time": "2008-12-15T22:48:08", "url": "https://files.pythonhosted.org/packages/8e/cb/b5f13c42116e3941c081dc76d83db913649c0a36990fce671534d0cb8bc4/python-sunlightapi-0.2.0.tar.gz" } ], "0.3.0": [ { "comment_text": "", "digests": { "md5": "3a6e34e72d696e70a4568f67c720fc97", "sha256": "754f4f439c429ae03b6486450755021ad9176e47dff36dfe846a4aeed4c163c5" }, "downloads": -1, "filename": "python-sunlightapi-0.3.0.tar.gz", "has_sig": false, "md5_digest": "3a6e34e72d696e70a4568f67c720fc97", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7988, "upload_time": "2009-02-02T15:59:00", "url": "https://files.pythonhosted.org/packages/ba/97/3c10e2f3e11ecbbac6bb05585feee9e5ba1a61964971be0e3e4cbde29869/python-sunlightapi-0.3.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "d28b64b56b4470d42d7f428bc747ccde", "sha256": "60788a2a63c5c187cb32f08feecc8914c51051a2604b05ca006fdcfb7073d8e5" }, "downloads": -1, "filename": "python-sunlightapi-0.4.0.tar.gz", "has_sig": false, "md5_digest": "d28b64b56b4470d42d7f428bc747ccde", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10063, "upload_time": "2009-04-30T19:27:20", "url": "https://files.pythonhosted.org/packages/f5/be/babfa73541debe9fb82bb86b2adee5516fbcb2699b7f3648f7cf39b02be3/python-sunlightapi-0.4.0.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "40e73995c8085f1fd81e85040341a21f", "sha256": "edbdd82ddef3847db3aa4072ea8843e61f82d34c47423d9cb2d73ca15db9d0f7" }, "downloads": -1, "filename": "python-sunlightapi-0.5.0.tar.gz", "has_sig": false, "md5_digest": "40e73995c8085f1fd81e85040341a21f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8948, "upload_time": "2009-10-06T19:58:23", "url": "https://files.pythonhosted.org/packages/2d/40/085d8a43918393757900d44c9f513c31863b05bc5d042cc4778bdc71b59d/python-sunlightapi-0.5.0.tar.gz" } ], "0.6.0": [ { "comment_text": "", "digests": { "md5": "aa8e3e8baa4e390493d76577cb685a77", "sha256": "98daf6dc024374ceae060a6084d0d3c940716b46e6c005793809a0193a5c7218" }, "downloads": -1, "filename": "python-sunlightapi-0.6.0.tar.gz", "has_sig": false, "md5_digest": "aa8e3e8baa4e390493d76577cb685a77", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8484, "upload_time": "2009-12-09T20:02:59", "url": "https://files.pythonhosted.org/packages/00/a3/b4cff3415ba8f505df5fd89b5bd8a2c9865353df53d8f0eaa8c2fea4ada0/python-sunlightapi-0.6.0.tar.gz" } ], "1.0.0": [ { "comment_text": "", "digests": { "md5": "007a5c40d510929118159ebc5a4bbd0e", "sha256": "faeaef7b3ce558192ab0d9599b381a00665285300256ffa7652c73b51f8c1d9d" }, "downloads": -1, "filename": "python-sunlightapi-1.0.0.tar.gz", "has_sig": false, "md5_digest": "007a5c40d510929118159ebc5a4bbd0e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8564, "upload_time": "2010-09-28T00:11:13", "url": "https://files.pythonhosted.org/packages/d5/cb/f9cd3cb3cb523e429a7ccab5ce7ed9b3218a26fa347b28595fe268bdefa4/python-sunlightapi-1.0.0.tar.gz" } ], "1.1.0": [ { "comment_text": "", "digests": { "md5": "5eb6a7e1e607970e5dced8207681313b", "sha256": "a9f437c9f666b6e738bdac16c9ede55ab42e897344825f85bf2ec973d8a2c85c" }, "downloads": -1, "filename": "python-sunlightapi-1.1.0.tar.gz", "has_sig": false, "md5_digest": "5eb6a7e1e607970e5dced8207681313b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7905, "upload_time": "2011-05-24T23:16:39", "url": "https://files.pythonhosted.org/packages/eb/65/5797b6809be14f64f044c69f78c905144ea8c9f415b2cfea74081bcafa87/python-sunlightapi-1.1.0.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "33625237c620d2b1ccc2ef1caddb836b", "sha256": "9c4ba8df662f513321541b7d860108fe2131fb6e2d2d04d9b62a90d67e152fae" }, "downloads": -1, "filename": "python-sunlightapi-1.1.1.tar.gz", "has_sig": false, "md5_digest": "33625237c620d2b1ccc2ef1caddb836b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7717, "upload_time": "2012-02-08T19:33:57", "url": "https://files.pythonhosted.org/packages/32/c3/e46af35f071af0c5efe26364219fe5eda8565b5a7fda83605c4553a2ef4b/python-sunlightapi-1.1.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "33625237c620d2b1ccc2ef1caddb836b", "sha256": "9c4ba8df662f513321541b7d860108fe2131fb6e2d2d04d9b62a90d67e152fae" }, "downloads": -1, "filename": "python-sunlightapi-1.1.1.tar.gz", "has_sig": false, "md5_digest": "33625237c620d2b1ccc2ef1caddb836b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7717, "upload_time": "2012-02-08T19:33:57", "url": "https://files.pythonhosted.org/packages/32/c3/e46af35f071af0c5efe26364219fe5eda8565b5a7fda83605c4553a2ef4b/python-sunlightapi-1.1.1.tar.gz" } ] }