- Make sure to install the python
requestslibrary, by enteringpip3 install requestsinto the terminal - To make JSON output more readable in Sublime Text, follow the instructions here
- 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 2016:
python3 fecAPI.py
- 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
- Take a look around at the Huffington Post Polls documentation
- Run the following command in your terminal to see links to the acutal polls:
python3 huffpostAPI.py
- The script will also save the raw json results in a file called
huffpost_api_results.json. To make these results more readable, follow the instructions in the Setup section above