This is a tool to retrieve election results data from Washtenaw County. The results can be found here.
We've used this for the 2021 Ann Arbor special elections, the 2022 midterm primary elections and the 2022 midterm general elections.
Previously, this scraper was configured to run through GitHub Actions. It is now configured to run as an AWS Lambda function.
You'll need a Python version >= 3.9 for zoneinfo
.
- Create a virtual environment by running
python -m venv venv
. - Activate your virtual environment by running
source venv/bin/activate
. - Install dependencies by running
pip install -r requirements.txt
. - Run the scraper with
ENVIRONMENT=local python main.py
.
- Use Python 3.9 as the runtime and x86_64 as the architecture.
- Use an execution role with access to S3.
- Add an EventBridge (CloudWatch Events) trigger with a schedule expression.
- Add the following environment variables to your Lambda configuration:
ENVIRONMENT=production BUCKET=subdomain.domain.com KEY=directory/filename
- Upload
lambda_handler.py
to the code section. - You may need to change the timeout in general configurations.
- You may need to add layers for external packages.