A lot of features #1

Merged
kbe merged 11 commits from develop into main 2025-07-20 14:32:07 +00:00
Showing only changes of commit 4b27a6f4a3 - Show all commits

View File

@@ -15,7 +15,7 @@ from dateutil.parser import parse
import pytz import pytz
from dotenv import load_dotenv from dotenv import load_dotenv
from urllib.parse import urlencode from urllib.parse import urlencode
from typing import List, Dict, Optional from typing import List, Dict, Optional, Any
load_dotenv() load_dotenv()
@@ -474,6 +474,7 @@ class CrossFitBooker:
logging.error("Authentication failed - exiting program") logging.error("Authentication failed - exiting program")
return return
try:
while True: while True:
try: try:
current_time: datetime = datetime.now(tz) current_time: datetime = datetime.now(tz)
@@ -491,6 +492,16 @@ class CrossFitBooker:
except Exception as e: except Exception as e:
logging.error(f"Unexpected error in booking cycle: {str(e)} - Traceback: {traceback.format_exc()}") logging.error(f"Unexpected error in booking cycle: {str(e)} - Traceback: {traceback.format_exc()}")
time.sleep(60) # Wait before retrying after error time.sleep(60) # Wait before retrying after error
except KeyboardInterrupt:
self.quit()
def quit(self) -> None:
"""
Clean up resources and exit the script.
"""
logging.info("Script interrupted by user. Quitting...")
# Add any cleanup code here
exit(0)
if __name__ == "__main__": if __name__ == "__main__":
@@ -501,3 +512,5 @@ if __name__ == "__main__":
# Start continuous booking loop # Start continuous booking loop
booker.run() booker.run()
logging.info("Script completed")