Print ballot details from Track My Ballot.
I wrote this partially as an excuse to play with web automation using playwright-python.
-
Fork and clone this repository
-
Create and activate a virtual environment
-
Install the package and its dependencies:
$ python -m pip install -e . $ python -m playwright install
-
Copy
.env.sample
to.env
, and fill in your name and address
$ python -m track_ma_ballot
election 11/3/2020 State Election
mailed First: 10/13/2020
received Not returned
status Not returned
Run this daily until the status changes:
election 11/3/2020 State Election
mailed First: 10/13/2020
received 10/19/2020
status Accepted
This repo includes a daily GitHub Action that runs the tests, which will fail until the ballot status is "Accepted":
E AssertionError: BallotDetails(election='11/3/2020 State Election', mailed='First: 10/13/2020', received='Not returned', status='Not returned')
E assert 'Not returned' == 'Accepted'
E - Accepted
E + Not returned
To make it work, create a GitHub secret named "ENV" with the contents of your .env
file.
Set up your development environment:
-
Install the packages required for development:
$ python -m pip install -e .[dev]
This will install:
Run the tests:
$ pytest
Format the code and run the checks:
$ invoke format
$ invoke check