Skip to main content
Documentation Status

Overview

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 data.gov 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 APIinfo@fec.gov 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

api_key = '<YOUR_DATA_DOT_GOV_API_KEY>'

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.

Metadata

Release files for fec-filing-iterator 1.0.0

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

Source distribution (sdist)

Source distribution for fec-filing-iterator 1.0.0
File Size Uploaded Provenance
fec_filing_iterator-1.0.0.tar.gz 5.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for fec-filing-iterator 1.0.0
File Interpreter ABI Platform
fec_filing_iterator-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.7 kB

Release files / fec_filing_iterator-1.0.0.tar.gz

Download URL fec_filing_iterator-1.0.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
39bf2e5d1d0bf042d6f3201eb5533d16ab55a63acd64f71a0f034e9205721a1d
BLAKE2b-256 checksum
How to use checksums
86da7d35989531e33ca6aac0abeaa75177f78a8ae124f1559c1bb449f47bf5f7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.6.1

Release files / fec_filing_iterator-1.0.0-py3-none-any.whl

Download URL fec_filing_iterator-1.0.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ab3989d4022f0d7f3a9813a7d9e898e378087e54ed7efe763ef7cd21a07946aa
BLAKE2b-256 checksum
How to use checksums
5d5a559e8d791b027c6be63a7b2bb836665888974f010cc2d13eb3dca2e0ccb0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.40.1 CPython/3.6.1

Security for fec-filing-iterator 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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