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.
This commit is contained in:
b267a 2025-08-04 19:54:56 +02:00
parent 97bc86ec59
commit 358cb45a85
2 changed files with 11 additions and 0 deletions

View file

@ -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}")

10
main.py
View file

@ -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")