swagger-client

This API allows you to explore the way candidates and committees fund their campaigns. The FEC API is a RESTful web service supporting full-text and field-specific searches on FEC data. Bulk downloads are available on the current site. Information is tied to the underlying forms by file ID and image ID. Data is updated nightly. There is a lot of data, but a good place to start is to use search to find interesting candidates and committees. Then, you can use their IDs to find report or line item details with the other endpoints. If you are interested in individual donors, check out contributor information in schedule_a. Get an API key here. That will enable you to place up to 1,000 calls an hour. Each call is limited to 100 results per page. You can email questions, comments or a request to get a key for 120 calls per minute to APIinfo@fec.gov. You can also ask questions and discuss the data in the FEC data Google Group. API changes will also be added to this group in advance of the change. The model definitions and schema are available at /swagger. This is useful for making wrappers and exploring the data. A few restrictions limit the way you can use FEC data. For example, you can’t use contributor lists for commercial purposes or to solicit donations. Learn more here. View our source code. We welcome issues and pull requests!

This Python package is automatically generated by the Swagger Codegen project:

  • API version: 1.0
  • Package version: 1.0.0
  • Build package: io.swagger.codegen.languages.PythonClientCodegen

Requirements.

Python 2.7 and 3.4+

Installation & Usage

pip install

If the python package is hosted on Github, you can install directly from Github

pip install git+https://github.com//.git

(you may need to run pip with root permission: sudo pip install git+https://github.com//.git)

Then import the package:

import swagger_client 

Setuptools

Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Then import the package:

import swagger_client

Getting Started

Please follow the installation procedure and then run the following:

from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint

# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'

# create an instance of the API class
api_instance = swagger_client.AuditApi(swagger_client.ApiClient(configuration))
api_key = 'DEMO_KEY' # str |  API key for https://api.data.gov. Get one at https://api.data.gov/signup.  (default to DEMO_KEY)
sort_null_only = false # bool | Toggle that filters out all rows having sort column that is non-null (optional) (default to false)
sort_hide_null = false # bool | Hide null values on sorted column(s). (optional) (default to false)
committee_designation = 'committee_designation_example' # str | Type of committee:         - H or S - Congressional         - P - Presidential         - X or Y or Z - Party         - N or Q - PAC         - I - Independent expenditure         - O - Super PAC   (optional)
audit_id = [56] # list[int] |  The audit issue. Each subcategory has an unique ID  (optional)
sub_category_id = 'all' # str |  The finding id of an audit. Finding are a category of broader issues. Each category has an unique ID.  (optional) (default to all)
committee_type = ['committee_type_example'] # list[str] | The one-letter type code of the organization:         - C communication cost         - D delegate         - E electioneering communication         - H House         - I independent expenditor (person or group)         - N PAC - nonqualified         - O independent expenditure-only (super PACs)         - P presidential         - Q PAC - qualified         - S Senate         - U single candidate independent expenditure         - V PAC with non-contribution account, nonqualified         - W PAC with non-contribution account, qualified         - X party, nonqualified         - Y party, qualified         - Z national party non-federal account  (optional)
committee_id = ['committee_id_example'] # list[str] |  A unique identifier assigned to each committee or filer registered with the FEC. In general committee id's begin with the letter C which is followed by eight digits.  (optional)
sort_nulls_last = false # bool | Toggle that sorts null values last (optional) (default to false)
qq = ['qq_example'] # list[str] | Name of candidate running for office (optional)
q = ['q_example'] # list[str] | The name of the committee. If a committee changes its name,     the most recent name will be shown. Committee names are not unique. Use committee_id     for looking up records. (optional)
sort = ['[\"-cycle\",\"committee_name\"]'] # list[str] | Provide a field to sort by. Use - for descending order. (optional) (default to ["-cycle","committee_name"])
page = 1 # int | For paginating through results, starting at page 1 (optional) (default to 1)
primary_category_id = 'all' # str |  Audit category ID (table PK)  (optional) (default to all)
audit_case_id = ['audit_case_id_example'] # list[str] |  Primary/foreign key for audit tables  (optional)
max_election_cycle = 56 # int |  Filter records to only those that are applicable to a given two-year period. This cycle follows the traditional House election cycle and subdivides the presidential and Senate elections into comparable two-year blocks. The cycle begins with an odd year and is named for its ending, even year.  (optional)
min_election_cycle = 56 # int |  Filter records to only those that are applicable to a given two-year period. This cycle follows the traditional House election cycle and subdivides the presidential and Senate elections into comparable two-year blocks. The cycle begins with an odd year and is named for its ending, even year.  (optional)
per_page = 20 # int | The number of results returned per page. Defaults to 20. (optional) (default to 20)
cycle = [56] # list[int] |  Filter records to only those that are applicable to a given two-year period. This cycle follows the traditional House election cycle and subdivides the presidential and Senate elections into comparable two-year blocks. The cycle begins with an odd year and is named for its ending, even year.  (optional)
candidate_id = ['candidate_id_example'] # list[str] |  A unique identifier assigned to each candidate registered with the FEC. If a person runs for several offices, that person will have separate candidate IDs for each office.  (optional)

try:
    api_response = api_instance.audit_case_get(api_key, sort_null_only=sort_null_only, sort_hide_null=sort_hide_null, committee_designation=committee_designation, audit_id=audit_id, sub_category_id=sub_category_id, committee_type=committee_type, committee_id=committee_id, sort_nulls_last=sort_nulls_last, qq=qq, q=q, sort=sort, page=page, primary_category_id=primary_category_id, audit_case_id=audit_case_id, max_election_cycle=max_election_cycle, min_election_cycle=min_election_cycle, per_page=per_page, cycle=cycle, candidate_id=candidate_id)
    pprint(api_response)
except ApiException as e:
    print("Exception when calling AuditApi->audit_case_get: %s\n" % e)

Documentation for API Endpoints

All URIs are relative to https://localhost/v1

Class Method HTTP request Description
AuditApi audit_case_get GET /audit-case/
AuditApi audit_category_get GET /audit-category/
AuditApi audit_primary_category_get GET /audit-primary-category/
AuditApi names_audit_candidates_get GET /names/audit_candidates/
AuditApi names_audit_committees_get GET /names/audit_committees/
CandidateApi candidate_candidate_id_get GET /candidate/{candidate_id}/
CandidateApi candidate_candidate_id_history_cycle_get GET /candidate/{candidate_id}/history/{cycle}/
CandidateApi candidate_candidate_id_history_get GET /candidate/{candidate_id}/history/
CandidateApi candidate_candidate_id_totals_get GET /candidate/{candidate_id}/totals/
CandidateApi candidates_get GET /candidates/
CandidateApi candidates_search_get GET /candidates/search/
CandidateApi candidates_totals_by_office_by_party_get GET /candidates/totals/by_office/by_party/
CandidateApi candidates_totals_by_office_get GET /candidates/totals/by_office/
CandidateApi candidates_totals_get GET /candidates/totals/
CandidateApi committee_committee_id_candidates_get GET /committee/{committee_id}/candidates/
CandidateApi committee_committee_id_candidates_history_cycle_get GET /committee/{committee_id}/candidates/history/{cycle}/
CandidateApi committee_committee_id_candidates_history_get GET /committee/{committee_id}/candidates/history/
CommitteeApi candidate_candidate_id_committees_get GET /candidate/{candidate_id}/committees/
CommitteeApi candidate_candidate_id_committees_history_cycle_get GET /candidate/{candidate_id}/committees/history/{cycle}/
CommitteeApi candidate_candidate_id_committees_history_get GET /candidate/{candidate_id}/committees/history/
CommitteeApi committee_committee_id_get GET /committee/{committee_id}/
CommitteeApi committee_committee_id_history_cycle_get GET /committee/{committee_id}/history/{cycle}/
CommitteeApi committee_committee_id_history_get GET /committee/{committee_id}/history/
CommitteeApi committees_get GET /committees/
CommunicationCostApi committee_committee_id_communication_costs_by_candidate_get GET /committee/{committee_id}/communication_costs/by_candidate/
CommunicationCostApi communication_costs_aggregates_get GET /communication_costs/aggregates/
CommunicationCostApi communication_costs_by_candidate_get GET /communication_costs/by_candidate/
CommunicationCostApi communication_costs_get GET /communication-costs/
CommunicationCostApi communication_costs_totals_by_candidate_get GET /communication_costs/totals/by_candidate/
DatesApi calendar_dates_export_get GET /calendar-dates/export/
DatesApi calendar_dates_get GET /calendar-dates/
DatesApi election_dates_get GET /election-dates/
DatesApi reporting_dates_get GET /reporting-dates/
DebtsApi schedules_schedule_d_get GET /schedules/schedule_d/
DebtsApi schedules_schedule_d_sub_id_get GET /schedules/schedule_d/{sub_id}/
DisbursementsApi schedules_schedule_b_by_purpose_get GET /schedules/schedule_b/by_purpose/
DisbursementsApi schedules_schedule_b_by_recipient_get GET /schedules/schedule_b/by_recipient/
DisbursementsApi schedules_schedule_b_by_recipient_id_get GET /schedules/schedule_b/by_recipient_id/
DisbursementsApi schedules_schedule_b_efile_get GET /schedules/schedule_b/efile/
DisbursementsApi schedules_schedule_b_get GET /schedules/schedule_b/
DisbursementsApi schedules_schedule_b_sub_id_get GET /schedules/schedule_b/{sub_id}/
EfilingApi efile_filings_get GET /efile/filings/
EfilingApi efile_reports_house_senate_get GET /efile/reports/house-senate/
EfilingApi efile_reports_pac_party_get GET /efile/reports/pac-party/
EfilingApi efile_reports_presidential_get GET /efile/reports/presidential/
ElectioneeringApi committee_committee_id_electioneering_by_candidate_get GET /committee/{committee_id}/electioneering/by_candidate/
ElectioneeringApi electioneering_aggregates_get GET /electioneering/aggregates/
ElectioneeringApi electioneering_by_candidate_get GET /electioneering/by_candidate/
ElectioneeringApi electioneering_get GET /electioneering/
ElectioneeringApi electioneering_totals_by_candidate_get GET /electioneering/totals/by_candidate/
FilerResourcesApi rad_analyst_get GET /rad-analyst/
FilerResourcesApi state_election_office_get GET /state-election-office/
FilingsApi candidate_candidate_id_filings_get GET /candidate/{candidate_id}/filings/
FilingsApi committee_committee_id_filings_get GET /committee/{committee_id}/filings/
FilingsApi filings_get GET /filings/
FilingsApi operations_log_get GET /operations-log/
FinancialApi committee_committee_id_reports_get GET /committee/{committee_id}/reports/
FinancialApi committee_committee_id_totals_get GET /committee/{committee_id}/totals/
FinancialApi elections_get GET /elections/
FinancialApi elections_search_get GET /elections/search/
FinancialApi elections_summary_get GET /elections/summary/
FinancialApi reports_committee_type_get GET /reports/{committee_type}/
FinancialApi totals_by_entity_get GET /totals/by_entity/
FinancialApi totals_committee_type_get GET /totals/{committee_type}/
IndependentExpendituresApi schedules_schedule_e_by_candidate_get GET /schedules/schedule_e/by_candidate/
IndependentExpendituresApi schedules_schedule_e_efile_get GET /schedules/schedule_e/efile/
IndependentExpendituresApi schedules_schedule_e_get GET /schedules/schedule_e/
IndependentExpendituresApi schedules_schedule_e_totals_by_candidate_get GET /schedules/schedule_e/totals/by_candidate/
LegalApi legal_search_get GET /legal/search/
LoansApi schedules_schedule_c_get GET /schedules/schedule_c/
LoansApi schedules_schedule_c_sub_id_get GET /schedules/schedule_c/{sub_id}/
PartyCoordinatedExpendituresApi schedules_schedule_f_get GET /schedules/schedule_f/
PartyCoordinatedExpendituresApi schedules_schedule_f_sub_id_get GET /schedules/schedule_f/{sub_id}/
PresidentialApi presidential_contributions_by_candidate_get GET /presidential/contributions/by_candidate/
PresidentialApi presidential_contributions_by_size_get GET /presidential/contributions/by_size/
PresidentialApi presidential_contributions_by_state_get GET /presidential/contributions/by_state/
PresidentialApi presidential_coverage_end_date_get GET /presidential/coverage_end_date/
PresidentialApi presidential_financial_summary_get GET /presidential/financial_summary/
ReceiptsApi schedules_schedule_a_by_employer_get GET /schedules/schedule_a/by_employer/
ReceiptsApi schedules_schedule_a_by_occupation_get GET /schedules/schedule_a/by_occupation/
ReceiptsApi schedules_schedule_a_by_size_by_candidate_get GET /schedules/schedule_a/by_size/by_candidate/
ReceiptsApi schedules_schedule_a_by_size_get GET /schedules/schedule_a/by_size/
ReceiptsApi schedules_schedule_a_by_state_by_candidate_get GET /schedules/schedule_a/by_state/by_candidate/
ReceiptsApi schedules_schedule_a_by_state_by_candidate_totals_get GET /schedules/schedule_a/by_state/by_candidate/totals/
ReceiptsApi schedules_schedule_a_by_state_get GET /schedules/schedule_a/by_state/
ReceiptsApi schedules_schedule_a_by_state_totals_get GET /schedules/schedule_a/by_state/totals/
ReceiptsApi schedules_schedule_a_by_zip_get GET /schedules/schedule_a/by_zip/
ReceiptsApi schedules_schedule_a_efile_get GET /schedules/schedule_a/efile/
ReceiptsApi schedules_schedule_a_get GET /schedules/schedule_a/
ReceiptsApi schedules_schedule_a_sub_id_get GET /schedules/schedule_a/{sub_id}/
SearchApi names_candidates_get GET /names/candidates/
SearchApi names_committees_get GET /names/committees/

Documentation For Models

Documentation For Authorization

apiKey

  • Type: API key
  • API key parameter name: api_key
  • Location: URL query string

Author