From fefbe1274cf752f490c7bf2bfd236ec8dc0e08d0 Mon Sep 17 00:00:00 2001 From: asolbach Date: Thu, 7 May 2026 10:36:37 +0200 Subject: [PATCH] Fix inverted token expiration check before API requests --- src/fyta_cli/fyta_client.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fyta_cli/fyta_client.py b/src/fyta_cli/fyta_client.py index 41f979e..82c73de 100644 --- a/src/fyta_cli/fyta_client.py +++ b/src/fyta_cli/fyta_client.py @@ -122,7 +122,7 @@ async def get_plants(self) -> dict[int, str]: self.session = ClientSession() self._close_session = True - if self.expiration.timestamp() > datetime.now().timestamp(): + if self.expiration.timestamp() < datetime.now().timestamp(): await self.login() # get new access token, if current token expired header = { @@ -170,7 +170,7 @@ async def get_plant_data(self, plant_id: int) -> dict[str, Any]: self.session = ClientSession() self._close_session = True - if self.expiration.timestamp() > datetime.now().timestamp(): + if self.expiration.timestamp() < datetime.now().timestamp(): await self.login() # get new access token, if current token expired header = { @@ -210,7 +210,7 @@ async def get_plant_data(self, plant_id: int) -> dict[str, Any]: async def get_plant_image(self, image_url) -> tuple[str | None, bytes] | None: """Fetch the user image from the API.""" - if self.expiration.timestamp() > datetime.now().timestamp(): + if self.expiration.timestamp() < datetime.now().timestamp(): await self.login() # get new access token, if current token expired header = {