def set_login_id(self):
"""Session id Creator
Creates a session id and writes it to the database.
Returns:
str. The id of the session.
"""
_logger.debug("Setting login token.")
session_id = hashlib.sha256(str.encode(str(time.time()))).hexdigest()
_logger.debug("Exipres in 2 hours")
expiry = int(time.time()) + 7200 #All cookies expire in 2 hours
_logger.debug("calling DB to add login token to database")
self.db("add_login_id", session_id, expiry)
_logger.debug("Session ID is {0}".format(session_id))
return session_id
评论列表
文章目录