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!

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, and attempts to implement each response in The Times’ API.


$ pip install nytcampfin

Or download and run

$ python install


NYT Campfin 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, set your API key as an environment variable NYT_CAMPFIN_API_KEY:


and then run the tests:

$ 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’

# retrieve a candidate’s details >>> cand = finance.candidates.get(‘H4NY11138’) >>> cand[‘name’] u’CLARKE, YVETTE D’

See the tests for plenty more examples.

Note on Patches/Pull Requests

  • Fork the project.
  • Make your feature addition or bug fix.
  • Add tests for it.
  • Send a pull request. Bonus points for topic branches.


Derek Willis,

Release History

This version
History Node


History Node


History Node


History Node


Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(6.5 kB) Copy SHA256 Hash SHA256
Source Jul 25, 2012

Supported By

WebFaction WebFaction Technical Writing 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 Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting