feat: enhance booking process with improved error handling and logging

Added logging to display message when outside booking window in booker.py
Added error handling for asyncio.run in crossfit_booker.py
Added logging for errors during booking process
This commit is contained in:
kbe
2025-08-12 02:02:20 +02:00
parent cfbb857cfb
commit fa9d73a9a9
3 changed files with 72 additions and 1 deletions

View File

@@ -213,6 +213,8 @@ class Booker:
# Wait for a short time before next check
time.sleep(60)
else:
# Display message when outside booking window
logging.info(f"Not booking now - current time {current_time} is outside the booking window ({target_time} to {booking_window_end})")
# Check again in 5 minutes if outside booking window
time.sleep(300)
except Exception as e:

View File

@@ -84,7 +84,10 @@ class CrossFitBooker:
This method initiates the booking process by running the Booker's main execution loop.
"""
import asyncio
asyncio.run(self.booker.run())
try:
asyncio.run(self.booker.run())
except Exception as e:
logging.error(f"Error in booking process: {str(e)}")
def get_auth_headers(self) -> Dict[str, str]:
"""