From 6ba25f37074ab02a7926c8b90ab286c5f8d87cff Mon Sep 17 00:00:00 2001 From: CNDRD Date: Sun, 24 Sep 2023 12:59:38 +0200 Subject: [PATCH] move internal login cooldown check --- siegeapi/auth.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/siegeapi/auth.py b/siegeapi/auth.py index 9b10d59..366c2a9 100644 --- a/siegeapi/auth.py +++ b/siegeapi/auth.py @@ -152,13 +152,15 @@ def load_creds(self) -> None: self.expiration = data.get("expiration", "") self.new_expiration = data.get("new_expiration", "") + self._login_cooldown = 0 + async def connect(self, _new: bool = False) -> None: """ Connect to Ubisoft, automatically called when needed """ + self.load_creds() + if self._login_cooldown > time.time(): raise FailedToConnect("Login on cooldown") - self.load_creds() - # If keys are still valid, don't connect again if _new: if self.new_key and datetime.fromisoformat(self.new_expiration[:26]+"+00:00") > datetime.now(timezone.utc):