Python script for downloading and organizing historical API data

Hey Bob, this script downloads the purpleair CF1 data, which is the standard data that PA monitors report. If you want to change that, you can insert different parameters into the field lists included on lines 86, 95, 104, 113, and 122. The full list of fields you can query is available on the API website:

https://api.purpleair.com/#api-groups-get-member-history

If you are looking for corrected PM2.5 data, I believe that the pm2.5_alt field is Lance’s corrected PM2.5 data, which has the most documentation associated with it. I correct my own data from the particle number fields, so I primarily utilize the data in the “secondary” data files.

I’m running this code on Windows 10 with python 3.11. I do believe you’ll need to download a couple modules to run this script if you don’t already have them (specifically the requests module). I just had my undergraduate assistant do it on his computer, and it seemed to work easily enough. I do think there could be issues if you’re running an older version of python that isn’t compatible with some of these modules.