refactor: Move files into src directory
Refactored project structure: Moved all Python modules to a src/ directory, updated imports accordingly. Added new environment variables to Dockerfile and docker-compose.yml. Removed Dockerfile.test and TODO file.
This commit is contained in:
35
src/book_crossfit.py
Executable file
35
src/book_crossfit.py
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import logging
|
||||
import traceback
|
||||
import asyncio
|
||||
from crossfit_booker import CrossFitBooker
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Configure logging once at script startup
|
||||
logging.basicConfig(
|
||||
level=logging.DEBUG, # Change to DEBUG for more detailed logs
|
||||
format='%(asctime)s - %(levelname)s - %(message)s',
|
||||
handlers=[
|
||||
logging.FileHandler("log/crossfit_booking.log"),
|
||||
logging.StreamHandler()
|
||||
]
|
||||
)
|
||||
|
||||
# Reduce the verbosity of the requests library's logging
|
||||
logging.getLogger("requests").setLevel(logging.WARNING)
|
||||
logging.info("Logging enhanced with request library noise reduction")
|
||||
|
||||
# Create an instance of the CrossFitBooker class
|
||||
booker = CrossFitBooker()
|
||||
|
||||
# Attempt to log in to the CrossFit booking system
|
||||
# TODO: Make a authentication during running request to not get kicked out
|
||||
if not booker.login():
|
||||
# If login fails, log the error and exit the script
|
||||
logging.error("Failed to login - Traceback: %s", traceback.format_exc())
|
||||
exit(1)
|
||||
|
||||
# Start the continuous booking loop
|
||||
booker.run()
|
||||
logging.info("Script completed")
|
||||
Reference in New Issue
Block a user