This script automates the process of checking for available appointments on a specified website. It uses Selenium to interact with the site, continuously checking for available slots and sending notifications when slots become available.
The following environment was used to develop and test this script:
- Python Version: 3.12.4
- OS: Ubuntu 24.04
- Selenium WebDriver: Firefox with Geckodriver
To install the dependencies, the following commands may be used:
Poetry is used to manage Python dependencies for this project.
pipx install poetry
sudo snap install firefox
If you used apt
to install Firefox, you'll need to modify the path to the default profile in main.py:20
. Here are
the paths to Firefox profiles:
- Ubuntu (Snap):
/home/$USER/snap/firefox/common/.mozilla/firefox/selenium
- Ubuntu (APT):
/home/$USER/.mozilla/firefox/selenium
- Windows:
C:\\Users\\$USER\\AppData\\Roaming\\Mozilla\\Firefox\\Profiles\\selenium
You can find the path to profiles by entering about:profiles
or about:support
in the Firefox address bar (look for "
Profile Directory").
Navigate to the project directory and install the necessary Python packages:
poetry install
You can use the provided bash script geckodriver_installer.sh
to install Geckodriver. This script downloads, extracts,
and installs Geckodriver for you.
To run the script:
bash geckodriver_installer.sh
To ensure Selenium uses the correct Firefox profile, create a new profile:
firefox -no-remote -CreateProfile "selenium /home/$USER/snap/firefox/common/.mozilla/firefox/selenium"
Once everything is set up, you can run the script directly. It will continuously check for available appointment slots and send a notification if any slots are found.
poetry run python main.py
If you need to manually debug the script by interacting with the browser, you can disable the headless mode. To do this,
simply comment out the line in the script where headless mode is set (main.py:70
):
# options.add_argument("--headless") # Comment this out to enable the browser UI for debugging
With this line commented out, the Firefox browser will open with a visible UI, allowing you to manually inspect and interact with the page while the script runs.
The script sends notifications using ntfy.sh. Make sure to update the NOTIFICATION_URL
variable in
the script if you need to change the notification endpoint.
If you plan to modify or further develop this script, the following Poetry commands may be useful:
- Add a Dependency:
poetry add <dependency>
- Install Dependencies:
poetry install
- Export Requirements:
poetry export -f requirements.txt -o requirements.txt
If you prefer to use Chrome instead of Firefox, you'll need to modify the script and use ChromeDriver. Replace the Firefox WebDriver setup with Chrome and update the necessary options to point to the Chrome profile instead.