This commit is contained in:
i 2026-02-07 13:50:59 +01:00
parent 4f4046e4a0
commit 716a565713
6 changed files with 1471 additions and 15 deletions

14
main.py
View file

@ -7,7 +7,7 @@ from auth.session import AnnySession
from booking.client import BookingClient
from utils.helpers import get_future_datetime
import pytz
from config.constants import RESOURCE_ID, TIMEZONE, SSO_PROVIDER, BOOKING_TIMES, RESOURCE_IDS
from config.constants import TIMEZONE, SSO_PROVIDER, BOOKING_TIMES, RESOURCE_IDS
def main():
@ -38,7 +38,7 @@ def main():
max_wait_seconds = 10 * 60 # 10 minutes
if 0 < seconds_until_midnight <= max_wait_seconds:
print("⏳ Waiting {seconds_until_midnight:.0f} seconds until midnight...")
print(f"⏳ Waiting {seconds_until_midnight:.0f} seconds until midnight...")
time.sleep(seconds_until_midnight)
elif seconds_until_midnight > max_wait_seconds:
print("⚡ More than 10 min until midnight, executing immediately...")
@ -56,11 +56,11 @@ def main():
if reservation_success:
return True
if RESOURCE_ID:
resource_id = RESOURCE_ID
reservation_success = booking.reserve(resource_id, start, end)
if reservation_success:
return True
# if RESOURCE_ID:
# resource_id = RESOURCE_ID
# reservation_success = booking.reserve(resource_id, start, end)
# if reservation_success:
# return True
resource_id = booking.find_available_resource(start, end)
reservation_success = booking.reserve(resource_id, start, end)
if reservation_success: