-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Currently API calls are made everytime they're requested, but it seems like we could cache these responses. Example:
$ curl 'https://api.open.fec.gov/v1/filings/?api_key=DEMO_KEY&cycle=2026&committee_id=C00900449' -I -L
HTTP/2 200
date: Fri, 17 Oct 2025 04:31:26 GMT
content-type: application/json
content-length: 7752
vary: Accept-Encoding
access-control-allow-origin: *
age: 0
cache-control: public, max-age=3600
...That max-age=3600 is a hint for browsers that they can cache responses for 60 minutes. We don't cache for the libfec CLI, but maybe we could.
Notably the efile/filings endpoint does not cache:
$ curl 'https://api.open.fec.gov/v1/efile/filings/?api_key=DEMO_KEY&cycle=2026&committee_id=C00900449' -I -L
HTTP/2 200
date: Fri, 17 Oct 2025 04:30:42 GMT
content-type: application/json
content-length: 1851
vary: Accept-Encoding
access-control-allow-origin: *
age: 0
cache-control: public, max-age=0
...Notably the max-age=0 header. The caching strategy is actually defined here:
This came up because if I re-run the same export over and over, my precious DEMO_TOKEN requests would get eaten up fast, even through it made the same API calls every time.
Could be a new .api-cache.db file inside the cache directory, like `.bulk-data.db.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels