Skip to content

Commit

Permalink
Refactored is_token_valid to be more readable
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielPDWalker committed May 6, 2022
1 parent 05cd200 commit e61380d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions tap_google_sheets/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@ def is_token_valid(self) -> bool:
return False
if not self.expires_in:
return True
if (
self.expires_in
> (
datetime.now(self.last_refreshed.tzinfo) - self.last_refreshed
).total_seconds()
):

now = datetime.now(self.last_refreshed.tzinfo)

if self.expires_in > (now - self.last_refreshed).total_seconds():
return True
return False

Expand Down

0 comments on commit e61380d

Please sign in to comment.