feat: Add book session script

This commit is contained in:
kbe
2025-08-08 22:21:17 +02:00
parent 6c29fc0802
commit 3b8a755a25
2 changed files with 55 additions and 0 deletions

46
execute_book_session.py Executable file
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)

9
test_book_session.sh Executable file
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