WORK IN PROGRESS NOT USABLE YET
This is a simple tool that can be used to automatically accept substitute teaching contracts on the Red Rover platform when they meet configurable criteria, to eliminate the obtusely dehumanizing process of needing to stay glued to a phone for hours refreshing the screen to see if jobs appear at odd hours.
Install Git and then clone this repository. Cloning via HTTPS is the most straightforward option.
Install Poetry and run poetry install
from the repository containing this README.md file. This will
install the Python dependencies used by the project.
Create a file .env in the same directory as this README.md file.
Copy and paste the contents of .env.sample into the new file, and
fill in the missing values.
- To get the value of
REDROVER_AUTH_TOKEN, login to https://app.redroverk12.com/ and open your browser's developer tools. Switch to the Network tab and reload the page so that you see a list of HTTP requests. Click on one of them and scroll down the detail view until you see the line that saysauthorizationfollowed by a long string starting witheyJ. This is the auth token. Note that it is very long and you may need to scroll horizontally to copy the entire value. You may want to triple-click to select the entire line. After you paste it, check that you got the entire thing; it should consist of three long strings of letters separated by periods.
Now create a file blue_rover_decider.py that will implement the
logic you would like to use to decide which teaching assignments you
would like the program to accept and which you would like it to
reject. You can refer to the contents of
blue_rover_decider_sample.py as an example.
Your code should define a function called decide that will be passed
an Assignment and should return a Decision, which can be one of
four possibilities:
Decision.ACCEPT: The program will try to automatically accept the assignment.Decision.REJECT: The program will ignore the assignment.Decision.NOTIFY: The program will send you a notification so that you can decide whether or not you want to accept the assignment.Decision.ERROR: Something unexpected happened in your code. The program will send you a notification to inform you of the error. You can also throw a Python exception, which will have the same effect.
If you want to change the decision logic, simply make the necessary code changes and restart the program. Any assignments that are still available will be re-processed using your updated logic.
Execute poetry run python -m blue_rover from the directory
containing this README.md file. This will validate your
configuration, check for posted assignments, process them according to
your rules, and print the resulting decisions to both your terminal
and a log file that is created automatically at data/actions.log. If
you want to see what happened while you were away, you can either
scroll upwards in your terminal, or check the log file. The program
will continue to scan for newly posted assignments every five seconds
until you interrupt it by pressing control-C.
In case you change the decision logic and you would like to see
whether it would have the intended effect, but the relevant assignment
is no longer available, there is a feature that allows you to test how
a past assignment would have been processed even if it is no longer
listed. All assignments that the program observes are automatically
saved inside the data/assignments-by-id directory that is created
for you. They are named with 32-character hexadecimal identifiers
which are used to refer to them in the log file and in output to your
terminal.
To test your decision logic against a past assignment, find its
32-character hexadecimal identifier from the log or your terminal, and
execute python run python -m blue_rover -t identifiergoeshere. This
will show you what would have been done with that assignment, and then
exit. Once you are satisfied, execute poetry run python -m blue_rover again (or interrupt and restart the existing process) to
continue scanning for assignments using the new logic.