Because of the COVID measures (in the Netherlands) reservations are obliged for a lot of activities, in this case sport climbing/bouldering. The number of slots are very limited (30 at the moment of writing). Some gyms are pretty popular and crowded. Hence, reservations are depleted pretty quickly.
A lot of bouldering gyms (in the Netherlands) are using the TopLogger service to arrange the reservations. Manually keeping track of slots coming available is a daunting task. This script can be used to notify you when a slot comes available at your favorite gym(s).
At the moment this script does not has persistent storage. Keeping track of sent notifications will only be done in memory. Adding persistent storage is one of the planned features, but nobody knows if and when this will feature will be implemented.
This script is tested on Python 3.8. As far as I know this script needs at least python 3.7 because of the use of "from __future__ import annotations" (models.py)
The following accounts are needed for this script to work.
First of all you need a TopLogger account so we can keep rack of available slots at your favorite
gym. Considering you're looking at this script you probably already have an account. If not go to
https://toplogger.nu to create an account. Credentials of your account need to be added to
config.py
.
To notify you about available slots the script uses Telegram. For this to work you need to have a Telegram account and create a Telegram bot. Create a group and add your bot to ths group.
For all of this to work you need to copy API token and chat_id (see:
https://api.telegram.org/bot<TOKEN>/getUpdates ) to config.py
.
No fancy packaging (yet). So if you want to use this script just clone the repo and run it.
Go to an appropriate folder and clone this repository.
$ git clone [email protected]:uipko/toplogger_notifier.git
Setup an virtual environment and install the dependencies.
$ python -m venv .venv && . .venv/bin/activate
$ pip install -r requirements.txt
Copy config_sample.py
to config.py
and update all settings.
NB: Make sure not to add config.py to git because it contains your secrets.
Start script and save 'logging' to file.
$ python -u ./main.py | tee `date -Iseconds`.log
The TopLogger Notifier telegram bot provides the following commands:
- status: Show last run & queued periods
- reset: Reset notified periods so we will notified again if there's a available slot.
If you're missing something and have some copious-free-time to to spare, feel free to create a pull request.
After installing a new dependency run the following to update requirements.txt.
(See how it works out when we do not pin versions for the required dependencies.)
$ pip-chill --no-version > requirements.txt
The following features could be implemented someday or not. Hopefully this COVID situation will nog give me enough time to implement all these features.The order of this list is not necessarily the order of implementation.
Idea's for new features:
- Setup pytest tests for existing code
- Persist data between runs
- List current reservations
- Add a way to get data of gyms
- Add packaging
- Add feature to make it possible to CRUD desired slots
- Add automagically make a reservation for an available slot