Skip to content

Commit

Permalink
Merge pull request #6 from codelif/expired-cookie-fix
Browse files Browse the repository at this point in the history
fix: webportal api returns invalid session expiry
  • Loading branch information
codelif authored Oct 27, 2024
2 parents dabe3ed + 7667297 commit 1dc9cd5
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pyjiit/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@ def authenticated(method):
def wrapper(self, *args, **kwargs):
if self.session is None:
raise NotLoggedIn

if self.session.expiry < datetime.now():
raise SessionExpired

# Commenting this because rn the webportal api is bugged,
# and returns wrong expiry time for prefectly valid cookies
# if self.session.expiry < datetime.now():
# raise SessionExpired

return method(self, *args, **kwargs)
wrapper.__doc__ = method.__doc__
Expand Down Expand Up @@ -97,8 +99,13 @@ def __hit(self, *args, **kwargs):


resp = requests.request(*args, **kwargs).json()
if type(resp["status"]) is int and resp["status"] == 401:
raise SessionExpired(resp["error"])

if resp["status"]["responseStatus"] != "Success":
raise exception("status:\n"+pformat(resp["status"]))



return resp

Expand Down

0 comments on commit 1dc9cd5

Please sign in to comment.