Skip to main content

A client for the Open States API

Project description

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://openstates.github.io/pyopenstates/

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyopenstates-1.1.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

pyopenstates-1.1.0-py2.py3-none-any.whl (9.2 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pyopenstates-1.1.0.tar.gz.

File metadata

File hashes

Hashes for pyopenstates-1.1.0.tar.gz
Algorithm Hash digest
SHA256 876c74fd55d9b3f9de6df8ba08717892b71e6c61fc8854d372fa586bb4f1b9d6
MD5 ab757c567cfcfa20b144fb93587407a9
BLAKE2b-256 df74f045d473ee9280cad370bc76670a378d0178f01b7a123117aefeac48f98d

See more details on using hashes here.

File details

Details for the file pyopenstates-1.1.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for pyopenstates-1.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 90f506d6a8ff1a8c6ec7e48a074d4b30f6da514c73f91cd19bf4b3d206f4c217
MD5 52698f331fad2d3d0ca3f2fab237b39f
BLAKE2b-256 2d9c32095d5e6cef6190017e25dc68f04ddeb1ae74655c94f7dbddd752fe380e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page