Skip to main content
File added late

1 file was added to this release more than 14 days after its initial publication. Inspect the release files before installing.

Python library for interacting with the TransparencyData.com API.

The TransparencyData.com API provides campaign contribution and lobbying data.

http://transparencydata.com/api/

python-transparencydata is a project of Sunlight Labs (c) 2010 Written by Jeremy Carbaugh <jcarbaugh@sunlightfoundation.com>

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

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

Requirements

python >= 2.4

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

Usage

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 http://services.sunlightlabs.com/api/ 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
gt

Greater than specified value.

lt

Less than specified value.

between

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))
in

Matches any in a range of values. Parameter must be a tuple or list.

See the parameter documentation (http://transparencydata.com/api/) 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: http://transparencydata.com/api/#contributions

Response documentation: http://transparencydata.com/docs/#contributions

Lobbying

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: http://transparencydata.com/api/#lobbying

Response documentation: http://transparencydata.com/docs/#lobbying

Metadata

Release files for python-transparencydata 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

File added late

1 file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release files before installing.

Source distribution (sdist)

Source distribution for python-transparencydata 0.1
File Size Uploaded
python-transparencydata-0.1.tar.gz 6.7 kB Details

Release files / python-transparencydata-0.1.tar.gz

File added late

This file was uploaded more than 14 days after the first file in this release.

While project maintainers occasionally add legitimate files to an existing release, late additions can also indicate a security compromise.

We recommend inspecting the release file before installing.

Download URL python-transparencydata-0.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
ab80ca3b36e1eea65c8d7fb00aaf32e36312afb8984e1d39f9c1b4051e78f1d9
BLAKE2b-256 checksum
How to use checksums
df572247f7360d77e75469c8dc46aac0d360a3a0d65f5b51855053e5120afffa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page