class GopyUser(): username = None token = None def __init__(self, username=None, token=None): self.username = username self.token = token self.api = GopyAPI(self) if token is None: try: f = open("users/" + username, 'r') self.token = f.readline().strip() f.close() if not self.api.isValidSession(): print("Current session token is invalid!") self.token = None except: pass def getUsername(self): return self.username def getToken(self): return self.token def getAPIHandle(self): return self.api def signUp(self, username, token): self.username = username self.token = token f = open("users/" + username, 'w') f.write(token) f.close()
def __init__(self,username=None,token=None): self.username=username self.token=token self.api= GopyAPI(self) if token is None: try: f= open("users/"+username,'r') self.token=f.readline().strip() f.close() if not self.api.isValidSession(): print("Current session token is invalid!") self.token=None except: pass