Skip to main content

A Python client for the New York Times Campaign Finance API

Project description

A very basic Python client for the New York Times [Campaign Finance API]( You’ll need an API key, which should be set as an environment variable to run the tests. The client returns JSON only, not full Python objects.


$ pip install nytcampfin

Or download and run

$ python install


Nytcampfin uses the [Kenneth Reitz’s Requests library]( for retrieving API endpoints and [Roman Haritonov’s requests-cache library]( for local caching. The cache is preconfigured to use a local sqlite database and set to expire after 5 minutes.


To run the tests, do the following:

$ python

The use of caching is disabled in the tests.


>>> from nytcampfin import NytCampfin

# retrieve today’s filings >>> today = >>> today[0][‘filing_id’] 793150

# retrieve a committee’s details >>> cmte = finance.committees.get(‘C00490219’,2012) >>> cmte[‘id’] u’C00490219’

Project details

Supported by

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