Skip to content

Roymprog/vondelgym-booker

Repository files navigation

This tool can be used to automatically attempt to book classes at Vondelgym that you subscribed to to receive notifications when a spot comes available. The tool will read your notifications from the profile page, then read the schedule to find a matching class and book it when there's a spot available.

The package code can be used to interact with the Vondelgym web application. It uses Beautifulsoup to parse the web app HTML and extracts the relevant information from it.

Usage

Install the tool

pip install .

Set your Vondelgym password as an environment variable

export VONDELGYM_PASSWORD=[your-password-here]

Run the tool

vondelgym-booker [your-email-here] 

Limitations

Currently only Crossfit classes at Vondelgym Oost can be booked using the tool.

How I use it

Recurring job

Running this tool only once is not very useful. That's why I run it as a systemd service on my Ubuntu machine to run the tool every so 20 seconds. This will ensure I booked the spot when it becomes available before someone else takes it.

There is a vondelgym.service at /etc/systemd/system/vondelgym.service looking as follows:

[Unit]
Description=Book Vondelgym classes
[Service]
ExecStart=vondelgym-booker [your-email-here]

There is an accompanying vondelgym.timer at /etc/systemd/system/vondelgym.timer

[Unit]
Description=Try to book Vondelgym classes every 20 seconds
[Timer]
OnBootSec=10
OnUnitActiveSec=20
AccuracySec=1s
[Install]
WantedBy=timers.target

My password is configured in an environment file at /etc/systemd/system/vondelgym.service.d/myenv.conf:

[Service]
Environment="VONDELGYM_PASSWORD=[your-password-here]"

Azure function

Prerequisites

Run locally

Be sure to set VONDELGYM_PASSWORD and VONDELGYM_EMAIL as environment variables either in your shell or in Values in local.settings.json.

func start

Deploy function app

Login

az login

Create resource group

az group create --name vondelgymbooking-rg --location "West Europe"

Create storage account

az storage account create --name vondelgymstorage --sku Standard_LRS -g vondelgymbooking-rg

Create function app

az functionapp create --consumption-plan-location westeurope --runtime python --runtime-version 3.8 --functions-version 4 --name vondelgym-booker --os-type linux --storage-account vondelgymstorage -g vondelgymbooking-rg 

Install local package and Azure function app requirements locally

pip install --target .python_packages/lib/site-packages -r requirements.txt  .

Publish this project as a function to the app

func azure functionapp publish vondelgym-booker --no-build --python

Update deployment

az functionapp update --name vondelgym-booker  --resource-group vondelgymbooking-rg 

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages