Skip to main content

OpenSecrets CRP API

A Python client for the Center for Responsive Politics API <https://www.opensecrets.org/resources/create/apis.php> at OpenSecrets.org.

Access campaign contribution and personal financial data for US congressional members.

You will need a Center for Responsive Politics API key <https://www.opensecrets.org/api/admin/index.php?function=signup>.

Install

From PyPI:

pip install opensecrets-crpapi

Or, download and use the install script:

git clone https://github.com/robrem/opensecrets-crpapi && cd opensecrets-crpapi
python setup.py install

Usage

All API functions are abstracted to corresponding client methods, and accept the respective parameters. Results are returned in JSON format, and pre-parsed to trim the fat. For example:

>>> from crpapi import CRP
>>> crp = CRP(API_KEY)

# get a specific legislator by CID
>>> cand = crp.candidates.get('N00007360')
>>> cand['lastname']
'PELOSI'

# get the top contributors to a candidate for a specific cycle
>>> contribs = crp.candidates.contrib('N00007360', '2016')
>>> contribs[0]['@attributes']['org_name']
'ActBlue'

# get fundraising information for a committee's members, by industry
>>> cmte = crp.committees.cmte_by_ind('HARM', 'F10')
>>> cmte[0]['@attributes']['member_name']
'Heck, Joe'

# use fetch to access the endpoints more directly, without pre-parsed results
>>> summ = crp.fetch('candSummary', cid='N00007360')
>>> summ['summary']['@attributes']['first_elected']
'1987'

Metadata

Release files for opensecrets-crpapi 0.2.2

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

Source distribution (sdist)

Source distribution for opensecrets-crpapi 0.2.2
File Size Uploaded Provenance Actions
opensecrets-crpapi-0.2.2.tar.gz 4.6 kB Without provenance Details for opensecrets-crpapi-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for opensecrets-crpapi 0.2.2
File Interpreter ABI Platform Actions
opensecrets_crpapi-0.2.2-py2.py3-none-any.whl Python 2, Python 3 none any Details for opensecrets_crpapi-0.2.2-py2.py3-none-any.whl

Total release size: 10.1 kB

Release files / opensecrets-crpapi-0.2.2.tar.gz

Download URL opensecrets-crpapi-0.2.2.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
74b81f556500a36aa238531e4e0599e84c1d51d22ef26c11314e7d4acf9a5acd
BLAKE2b-256 checksum
How to use checksums
760e65ee18146bd8aeb0cb0bc77d840638d314869a7085e8b7dffa2838af99d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / opensecrets_crpapi-0.2.2-py2.py3-none-any.whl

Download URL opensecrets_crpapi-0.2.2-py2.py3-none-any.whl
Size 5.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
eea380034d456553e262578f030556166d2d998eafbb5619a7a2d6d9086a4294
BLAKE2b-256 checksum
How to use checksums
73cd22b379fcd5f3d18154e8a67749c16d63c9882dd9635025d45c0af3fe2da2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for opensecrets-crpapi 0.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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