Skip to main content

Utility to iterate over FEC filings through the FEC API

Project description

Documentation Status


fec-filing-iterator provides a simple interface for iterating through results from the Federal Election Commission’s API as a single, lazily evaluated stream. The FEC’s API provides access to a wealth of data on where candidates and committees get their funds, what they spend them on, and more. This library simply tries to make the API easier to work with in Python.

Getting Started

In order to use this library you will first need to get a API key, which you can request here. Once you get an API key you will be allowed to make 1,000 requests to the FEC API per hour. If you want more throughput you can request that your key be upgraded to be allowed to make 120 calls per minute by emailing and asking nicely.

Next, you’ll have to install the library:

pip install fec-filing-iterator

Now you’re all set to start exploring campaign finance data! For example:

import json
from fec_filing_iterator import schedules


params = {
    'two_year_transaction_period': 2020,
    'committee_id': 'C00696948',

for filing in schedules('a', api_key=api_key, params=params):
    print(json.dumps(filing, indent=4))

Factories and Iterators

This library only tries to provide an easy way to access and iterate through the paginated results returned by the FEC API. It does not currently attempt to provide a full and consistent interface for retrieving arbitrary subsets of information from the API. Lots of powerful searches and queries can be parameterized through the API, but we leave it up to you to read the FEC’s documentation and find the appropriate parameters yourself.

The main workhorse of the library is the FilingIterator class. Construct it with API credentials, an API endpoint to iterate over, and whatever parameters you want, and you can treat the full set of records as one big iterable.

The library also provides several handy factory functions that will construct the FilingIterator object and configure it for the appropriate endpoint.

Project details

Download files

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

Files for fec-filing-iterator, version 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size fec_filing_iterator-1.0.0-py3-none-any.whl (7.9 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size fec_filing_iterator-1.0.0.tar.gz (5.8 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page