Skip to content

michigandaily/washtenaw-elections-scraper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

washtenaw-elections-scraper

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.

Local development

You'll need a Python version >= 3.9 for zoneinfo.

  1. Create a virtual environment by running python -m venv venv.
  2. Activate your virtual environment by running source venv/bin/activate.
  3. Install dependencies by running pip install -r requirements.txt.
  4. Run the scraper with ENVIRONMENT=local python main.py.

Production notes

  • 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.

About

Washtenaw County election results scraper

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages