flaschengeist/geruecht/model/accessToken.py

28 lines
680 B
Python

from datetime import datetime
class AccessToken():
timestamp = None
user = None
token = None
def __init__(self, user, token, timestamp=datetime.now()):
self.user = user
self.timestamp = timestamp
self.token = token
def updateTimestamp(self):
self.timestamp = datetime.now()
def __eq__(self, token):
return True if self.token == token else False
def __sub__(self, other):
return other - self.timestamp
def __str__(self):
return f"AccessToken({self.user}, {self.token}, {self.timestamp}"
def __repr__(self):
return f"AccessToken({self.user}, {self.token}, {self.timestamp}"