A Python module for accessing the Open States API
Switch branches/tags
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
docs API key docs May 15, 2017
.gitignore
.travis.yml Actually fix the API key for tests May 14, 2018
LICENSE Initial commit Jan 28, 2017
README.rst Update documentation link in README.rst Nov 15, 2017
dev-requirements.txt try sphinx rtd theme Feb 2, 2017
pyopenstates.py 1.2.0 - Account for API rate limits - closes #8 May 15, 2018
requirements.txt Commit the actual code Jan 28, 2017
setup.cfg Fix typos Feb 1, 2017
setup.py Use module version for package May 14, 2018
test_pyopenstates.py 1.2.0 - Account for API rate limits - closes #8 May 15, 2018

README.rst

pyopenstates

Build Status

A Python client for the Open States API.

The Open States project provides data on legislators, bills, committees, and districts in legislatures of all 50 US states, plus D.C. and Puerto Rico. This data is gathered directly from the legislatures, and converted to a common format for interested developers, through a JSON API and data dumps. The project was originally created by the Sunlight Foundation as a part of Sunlight Labs. The Sunlight Foundation has since shut down Sunlight Labs, and Open States is now an independent project.

This module is intended to be a replacement for the openstates methods provided by the origional sunlight package. However, it is not a drop-in replacement; the methods are slightly different, and some features have been added.

Please consider donating or volunteering to support the Open States project. The data provided to the public by various legislatures can frequently change format. Without regularly-maintained scrapers and server infrastructure, this consistent and free API would not be possible.

Features

  • Compatible with Python 2.7-3+
  • Full Unicode support
  • Supports all methods, options, and data types provided by the API
  • Methods for downloading data dumps
  • Automatic conversion of string dates and timestamps to datetime objects
  • Tested releases
  • Set API Key via environment variable or in code.

Installation

pyopenstates can be installed using pip. Installation in a virtualenv is recommended.

To install the latest release, run:

$ pip install -U pyopenstates

Or, install the latest commit from git, run:

$ pip install -U git+https://github.com/openstates/pyopenstates

API Keys

To use the Open States API you must obtain an API Key.

Once you have your key you can use it with this library by setting the OPENSTATES_API_KEY environment variable or calling pyopenstates.set_api_key.

Documentation

Documentation is provided in detailed docstrings, and in HTML format at

https://pyopenstates.readthedocs.io/en/latest/