From 62614a0efcfd1144bed329ba5ab83a1be16437d7 Mon Sep 17 00:00:00 2001 From: Charlie Bini <5003326+cbini@users.noreply.github.com> Date: Tue, 15 Feb 2022 12:27:10 -0600 Subject: [PATCH] fix autorize() checks --- powerschool/client.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/powerschool/client.py b/powerschool/client.py index 4517ef3..9d57476 100644 --- a/powerschool/client.py +++ b/powerschool/client.py @@ -32,8 +32,7 @@ def __init__(self, host, **kwargs): def authorize(self, auth): """""" - # access token (dict) - if isinstance(auth, dict): + if isinstance(auth, dict): # access token (dict) # check if access token is still valid expires_at = datetime.fromtimestamp(auth.get("expires_at")) now = datetime.now() @@ -41,9 +40,7 @@ def authorize(self, auth): self.access_token = auth else: raise TokenExpiredError("Access token expired!") - - # client credentials (tuple) - if isinstance(auth, tuple): + elif isinstance(auth, tuple): # client credentials (tuple) # fetch new access token token_url = f"{self.base_url}/oauth/access_token/" client_id, client_secret = auth