Skip to main content

A python-based bot for automatic resasports slot booking

Project description

No queues. Just gains.

Logo

Release Build status codecov Commit activity License Documentation Contributor Covenant

PySportBot empowers you to programmatically book fitness classes at any sports center that uses the Resasports booking management software.

Install

pip install pysportbot

Quick Start

from pysportbot import SportBot

# Create bot instance, will list available centres if requested
bot = SportBot(log_level='INFO', print_centres=False, time_zone = 'Europe/Madrid')

# Connect to service with email and password as well as the name of the centre
bot.login('email', 'password', 'centre')

# List available activites
bot.activities(limit = 10)

# List bookable slots for an activity on a specific day
bot.daily_slots(activity='YourFavouriteGymClass', day = '2025-01-03', limit = 10)

# Book an activity slot on a specific day and time
bot.book(activity='YourFavouriteGymClass', start_time = '2024-12-30 07:00:00')

# Cancel an activity slot on a specific day and time
bot.cancel(activity='YourFavouriteGymClass', start_time = '2024-12-30 07:00:00')

Advanced usage as service

You can easily run pysportbot as a service to manage your bookings automatically with

python -m pysportbot.service --config config.json

The service requires a json configuration file that specifies your user data and how you would like to book your classes. Currently, two types of configuration are supported:

1. Book an upcoming class now

Let's say you would like to book Yoga next Monday at 18:00:00, then your config.json would look like:

{
    "email": "your-email",
    "password": "your-password",
    "center": "your-gym-name",
    "booking_execution": "now",

    "classes": [
        {
            "activity": "Yoga",
            "class_day": "Monday",
            "class_time": "18:00:00",
        }
    ]
}

2. Book an upcoming class on a specific day and time

Let's say you would like to book Yoga next Monday at 18:00:00, but the execution of the booking should only happen on Friday at 07:30:00 then your config.json would look like:

{
    "email": "your-email",
    "password": "your-password",
    "center": "your-gym-name",
    "booking_execution": "Friday 07:30:00",

    "classes": [
        {
            "activity": "Yoga",
            "class_day": "Monday",
            "class_time": "18:00:00",
        }
    ]
}

Note: By default, PySportBot will attempt to execute N bookings in parallel, where N is the number of available cores on your machine.

The service also provides various other options that can be inspected with

python -m pysportbot.service --help

Currently supported options include:

  1. --booking-delay: sets a global delay in seconds before booking execution [default: 0]
  2. --retry-attempts: sets the number of retries attempted in case a booking attempt fails [default: 3]
  3. --retry-delay: sets the delay in seconds between booking retries [default: 5]
  4. --time-zone: sets the time zone for the service [default: Europe/Madrid]
  5. --log-level: sets the log-level of the service [default: INFO]
  6. --max-threads: limits the number of used threads for parallel bookings [default: -1]

LICENSE

pysportbot is free of use and open-source. All versions are published under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pysportbot-0.0.11.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pysportbot-0.0.11-py3-none-any.whl (23.1 kB view details)

Uploaded Python 3

File details

Details for the file pysportbot-0.0.11.tar.gz.

File metadata

  • Download URL: pysportbot-0.0.11.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Linux/6.8.0-1020-azure

File hashes

Hashes for pysportbot-0.0.11.tar.gz
Algorithm Hash digest
SHA256 16bcd324b9128f6b693e3e0a07a2a3505a1ab38a6576f97f28301484cd90184e
MD5 3d5acaf0bb62036eb0fea305e2fbb14d
BLAKE2b-256 d569a55f53c6605304abb94e60a2ea2ef3f8fa07d3035475ca0e6ce795b61c2d

See more details on using hashes here.

File details

Details for the file pysportbot-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: pysportbot-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 23.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.8 Linux/6.8.0-1020-azure

File hashes

Hashes for pysportbot-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 35dd70728222fc08f62f0b34522a0d3d023779285af46f163bfbe6aa3ef02a6e
MD5 f785dff8832229c0b4c987ce44595e86
BLAKE2b-256 8392cccaac6f046729d2664d81540a15f829f7eae84b93d3530befb195b61b75

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page