Skip to content

Latest commit

 

History

History
66 lines (39 loc) · 2.36 KB

README.md

File metadata and controls

66 lines (39 loc) · 2.36 KB

AoCH Leaderboard

Overview

This project shows the current statistics and leaderboard of CH members for the AoC.

Guidelines

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 (L68: get_data());
  • the puzzle for each day is requested only once and 'cached' runtime only, so restarting the server removes the 'cache' (L93: 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.

Installation

To run the project, follow these steps:

1. Create a Virtual Environment

Use the following command to create a virtual environment named "venv" within your project folder:

python -m venv venv

2. Activate the Virtual Environment

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

3. Install Dependencies

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

4. Adding environmental variables

Configuration of the leaderboard is stored in environment variables. 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.

5. Start the server

Start the server by running the application with waitress, e.g. session=<SESSION> leaderboard_id=<LEADERBOARD_ID> waitress-serve --call AoCH:create_app

Docker

The project can also be run using the provided Dockerfile for this, simply build the docker image, docker build -t aoch . and run it: docker run aoch.