feat: Scripts display preferred sessions during execution

This commit is contained in:
kbe
2025-08-12 00:09:56 +02:00
parent d31976084a
commit 7161a11905
5 changed files with 98 additions and 777 deletions

View File

@@ -0,0 +1,46 @@
#!/usr/bin/env python3
"""
Script to demonstrate how to execute the book_session method from crossfit_booker.py
"""
import os
import sys
import logging
from crossfit_booker import CrossFitBooker
# Configure logging
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
def main():
# Check if a session ID was provided as an argument
if len(sys.argv) < 2:
print("Usage: python execute_book_session.py <session_id>")
sys.exit(1)
session_id = sys.argv[1]
# Create an instance of CrossFitBooker
booker = CrossFitBooker()
# Login to authenticate
print("Attempting to authenticate...")
if not booker.login():
print("Failed to authenticate. Please check your credentials and try again.")
sys.exit(1)
print("Authentication successful!")
# Book the session
print(f"Attempting to book session with ID: {session_id}")
success = booker.book_session(session_id)
if success:
print(f"Successfully booked session {session_id}")
else:
print(f"Failed to book session {session_id}")
if __name__ == "__main__":
try:
main()
except Exception as e:
print(f"An error occurred: {e}")
sys.exit(1)

View File

@@ -0,0 +1,9 @@
#!/bin/bash
# Test script to demonstrate how to use the execute_book_session.py script
# Sample session ID (this should be a valid session ID from the crossfit booking system)
SESSION_ID="19291768"
# Run the script with the sample session ID
echo "Attempting to book session with ID: $SESSION_ID"
python execute_book_session.py $SESSION_ID