The ACC Hut Availability Bot is a Python-based tool that checks for available spots at Alpine Club of Canada (ACC) huts on a specific date and sends an email notification if spots are available. Popular huts often have limited availability and high demand. This bot aims to assist those holding their breath for cancellations.
To set up the bot, create a .env
file in the root directory with the following variables:
EMAIL_PASSWORD=your_gmail_app_password
SENDER_EMAIL=your_email@gmail.com
RECIPIENT_EMAIL=recipient_email@example.com
Each variable serves the following purpose:
EMAIL_PASSWORD
: The 16-character app password for your Gmail account.SENDER_EMAIL
: The email address that will send the notification.RECIPIENT_EMAIL
: The email address that will receive the notification.
To receive an email from the bot, create a 16-character app password for your Gmail account. This requires 2FA ( Two-Factor Authentication) to be enabled on your account. Follow these steps:
- Visit App Passwords.
- Follow the instructions to generate a new app password.
- Add this password to your
.env
file asEMAIL_PASSWORD
.
Customize the subject and body of the email in the send_email
function in bot.py
.
It's recommended to use a virtual environment for this project. Run the following commands to set up:
python3.12 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
Set the target_date
variable in the if __name__ == "__main__":
section in bot.py
to the desired date in the
format YYYY-MM-DD
.
Logs are saved to hut_availability.log
in the root directory.
The huts
dictionary in bot.py
contains configurations for each hut, including names, URLs, headers, and booking
links. Add or remove huts as needed.
For example, to add the Scott Duncan Hut:
- Go to the Scott Duncan Hut ACC page and click the "Booking" tab.
- Open Chrome Developer Tools and select the "Network" tab.
- Click the desired date on the date picker and observe the network request that appears.
- Right-click the request and select "Copy" > "Copy as cURL (bash)".
- Extract the URL and headers from the copied cURL command.
The default configuration for the Scott Duncan Hut is included but may need updating due to cookie expiration.
To run the bot every 15 minutes using cron:
-
Open your crontab file with
crontab -e
. -
Add the following line:
*/15 * * * * cd /path/to/acc-hut-availability-bot && ./venv/bin/python3 bot.py
This will execute bot.py
from the specified directory every 15 minutes. Ensure the path is correct for your setup.
If you encounter issues, check the following:
- Ensure all dependencies are installed and the virtual environment is activated.
- Verify that the
.env
file contains the correct email credentials. - Check
hut_availability.log
for error messages.