Skip to content

Commit

Permalink
move internal login cooldown check
Browse files Browse the repository at this point in the history
  • Loading branch information
CNDRD committed Sep 24, 2023
1 parent 07b359c commit 6ba25f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions siegeapi/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 6ba25f3

Please sign in to comment.