From 358cb45a85dd6d5f259fabd15a7d175c41a38908 Mon Sep 17 00:00:00 2001 From: b267a Date: Mon, 4 Aug 2025 19:54:56 +0200 Subject: [PATCH] Trying new system. New approach: pipeline will trigger BEFORE midnight, script waits till midnight and then immediately reserves the library space. This hopefully improves the speed and the success-rate. --- auth/session.py | 1 + main.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/auth/session.py b/auth/session.py index 0114ba3..ea154a6 100644 --- a/auth/session.py +++ b/auth/session.py @@ -17,6 +17,7 @@ class AnnySession: self._sso_login() self._kit_auth() self._consume_saml() + print("✅ Login successful.") return self.session.cookies except Exception as e: print(f"[Login Error] {e}") diff --git a/main.py b/main.py index 8302762..5907269 100644 --- a/main.py +++ b/main.py @@ -1,14 +1,20 @@ +import datetime import os +import time + from dotenv import load_dotenv from auth.session import AnnySession from booking.client import BookingClient from utils.helpers import get_future_datetime +import pytz def main(): load_dotenv('.env', override=True) username = os.getenv("USERNAME") password = os.getenv("PASSWORD") + start_time = datetime.datetime.now(pytz.timezone('Europe/Berlin')) + if not username or not password: print("❌ Missing USERNAME or PASSWORD in .env") return @@ -20,6 +26,10 @@ def main(): return booking = BookingClient(cookies) + + while start_time.day == datetime.datetime.now(pytz.timezone('Europe/Berlin')).day: + time.sleep(1) + start = get_future_datetime(hour="13:00:00") end = get_future_datetime(hour="18:00:00")