This project shows the current statistics and leaderboard of CH members for the AoC.
This script follows the guidelines stated by Advent of Code, namely:
- it includes the emails of the maintainers and a link to the current repo in the User-Agent header for all outbound requests;
- it throttles the requests made to the website by only requesting (private) leaderboard updates every 15 minutes (
L55: get_data()
); - the puzzle for each day is requested only once and 'cached' runtime only, so restarting the server removes the 'cache' (
L79: get_day_assignment()
).
Do not misuse this leaderboard we created and if you decide to fork this repository, please update the User-Agent to your own email and repository.
To run the project, follow these steps:
Use the following command to create a virtual environment named "venv" within your project folder:
python -m venv venv
Activate the virtual environment. Use one of the following commands based on your operating system:
-
On Windows:
venv\Scripts\activate
-
On Unix or MacOS:
source venv/bin/activate
Your terminal prompt should now display (venv)
.
Install the required packages specified in the requirements.txt
file:
pip install -r requirements.txt
note: Remember to update your virtual environment whenever you add or remove dependencies. You can do this by running pip freeze > requirements.txt
to update the requirements.txt
file
Create a .env
file in the project folder. Add the following two variables: session
and leaderboard_id
. session
is the cookie stored by AoC if you authenticate in the browser (valid for a month) and leaderboard_id
can be found in the url of the leaderboard you are trying to add.
Start the server by running the app.py
file. If the server has started, you can go to localhost:5000
in your browser.