Example of querying the FOIArchive REST API via a Python script and notebook:
To run the script on a computer with git and Python3 installed:
- Clone this repo:
git clone https://github.com/history-lab/foiarchive-api-python-example.git - Move to the newly created directory:
cd foiarchive-api-python-example - (Recommended) create a new virtual environment:
python3 -m venv env - (Recommended) activate the new virtual environment:
. env/bin/activate - Install the required libraries (requests and pandas):
pip install -r requirements.txt - Run the script:
python ex.py - Try processing the resulting DataFrame or altering the query