Download multiple redistricting datasets at one time using the API (Application Programming Interface)
Becoming a designated API user requires:
RDH_API.ipynb
.RDH_API_SET_PARAM.ipynb
.Download_API.txt
.Run All
and fill
out the prompts as needed (e.g. username, password, states of
interest, filtering parameters, etc.) for the
RDH_API
script, and set the parameters manually at the
top for RDH_API_SET_PARAM
script.
The scripts use pandas, requests, io, numpy, and getpass libraries. If
you do not have these on your system, you may need to install them.
You should not have to modify any of the code to retrieve data from
the API, which will be extracted to the directory in which this script
is housed on your system. You must be a designated API user by RDH in
order for the script to work, this is a different status than a
normal, verified account.
Due to limitations of WordPress API, you can only download data by
around 4 states at a time at most, as the API will only pull a list of
1,000 potential datasets for download at a time.
The notebook uses pandas version 1.3.1, requests version 2.25.1, and
numpy version 1.20.3. The script may run on different versions, but if
you are receiving an import error, try installing these versions.