#!/usr/bin/env python3 """ Main entry point for the CrossFit Booker application. This script initializes the CrossFitBooker and starts the booking process. """ import logging import os from src.auth import AuthHandler from src.booker import Booker from src.session_notifier import SessionNotifier # Load environment variables from dotenv import load_dotenv load_dotenv() def main(): """ Main function to initialize the Booker and start the booking process. """ # Set up logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', handlers=[ logging.StreamHandler() ] ) # Initialize components auth_handler = AuthHandler( os.environ.get("CROSSFIT_USERNAME"), os.environ.get("CROSSFIT_PASSWORD") ) # Initialize notification system email_credentials = { "from": os.environ.get("EMAIL_FROM"), "to": os.environ.get("EMAIL_TO"), "password": os.environ.get("EMAIL_PASSWORD") } telegram_credentials = { "token": os.environ.get("TELEGRAM_TOKEN"), "chat_id": os.environ.get("TELEGRAM_CHAT_ID") } enable_email = os.environ.get("ENABLE_EMAIL_NOTIFICATIONS", "true").lower() in ("true", "1", "yes") enable_telegram = os.environ.get("ENABLE_TELEGRAM_NOTIFICATIONS", "true").lower() in ("true", "1", "yes") notifier = SessionNotifier( email_credentials, telegram_credentials, enable_email=enable_email, enable_telegram=enable_telegram ) # Initialize the Booker booker = Booker(auth_handler, notifier) # Run the booking process import asyncio asyncio.run(booker.run()) if __name__ == "__main__": main()