Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update schemas from openfec swagger documentation #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

esonderegger
Copy link

This PR updates the __init__ method for each of the classes in pyopenfec to have the fields that are shown in the "response class" for each data type at https://api.open.fec.gov/developers/.

The reason I got started exploring with this was that our reporters prefer the html_url links to the pdf_url links for reports and filings.

Instead of just adding those fields, I figured I would see what else was different between the models and the what is currently in the swagger documentation.

To test the new fields are indeed present, run:

from pyopenfec import Committee
committees = Committee.fetch(designation='P', candidate_id='H4VA10089')
for committee in committees:
    reports = committee.select_reports(report_type='Q1', year=2018, is_amended=False)
    for report in reports:
        print(report.html_url)

and verify that the link takes you the 2018 Q1 report for Barbara Comstock.

I suppose there is a chance removing fields that are no longer returned by the API could break some code that expects those attributes to be present. I fear it would be confusing to leave them in, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant