Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Library for interacting with the Sunlight Labs Transparency Data API

Project Description

Python library for interacting with the API.

The API provides campaign contribution and lobbying data.

python-transparencydata is a project of Sunlight Labs (c) 2010 Written by Jeremy Carbaugh <>

All code is under a BSD-style license, see LICENSE for details.



python >= 2.4

simplejson >= 1.8 (not required with Python 2.6, will use built-in json module)


To initialize the api, all that is required is for it to be imported and for an API key to be defined.

(If you do not have an API key visit to register for one.)

Import TransparencyData class and set your API key:

>>> from transparencydata import TransparencyData
>>> td = TransparencyData('sunlight-api-key')

Parameter Operators

Some parameters allow multiple values or greater than, less than, or between operations. We allow operators to be added similar to the method used by the Django ORM. The operator is appended to the end of the parameter name using double underscore.

>>> td.contributions(amount=100)                        # contributions equal to 100 dollars
>>> td.contributions(amount__lt=100)            # contributions less than 100 dollars
>>> td.contributions(cycle=1990)                        # contributions from the 1990 election cycle
>>> td.contributions(cycle__in=(1990,2008)) # contributions from the 1990 and 2008 election cycles
Greater than specified value.
Less than specified value.

Between the lesser value and greater value. Parameters must be passed as a two-value tuple or list.

>>> td.contributions(date__between=(start_date, end_date))
Matches any in a range of values. Parameter must be a tuple or list.

See the parameter documentation ( to find out which operators are valid for each parameter.

Campaign Contributions

To find all contributions to Chris Van Hollen from the state of CA during the 2008 election cycle:

>>> td.contributions(cycle=2008, contributor_state='CA', recipient_ft='van hollen')

A list of valid contributions parameters can be accessed programmatically:

>>> print td.contributions.parameters

Parameter documentation:

Response documentation:


To find all lobbying conducted by John Wonderlich:

>>> td.lobbying(lobbyist_ft='john wonderlich')

A list of valid lobbying parameters can be accessed programmatically:

>>> print td.lobbying.parameters

Parameter documentation:

Response documentation:

Release History

This version
History Node


Download Files

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

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(6.7 kB) Copy SHA256 Hash SHA256
Source None Feb 3, 2012

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers