Sample APIs
Setup
- Make sure to install the python
requests
library, by entering pip3 install requests
into the terminal
- To make JSON output more readable in Sublime Text, follow the instructions here
FEC API
- Take a look around at the FEC API documentation
- Before running the FEC API script, you will need your own API key, which you can find here
- Since you don’t want to make your key public, add your key to your environment variables by typing
export FECKEY='<your_key_here>'
into the terminal
- Run the following command in your terminal to see candidates who ran for office in Massachusetts in 2022:
- The script will also save the raw json results in a file called
fec_api_results.json
. To make these results more readable, follow the instructions in the Setup section above