def read(self):
"""
Returns the cookie if valid and exists, None otherwise.
"""
if self.exists():
with open(config.cdms_cookie_path, 'rb') as f:
try:
ciphertext = self.crypto.decrypt(f.read())
return pickle.loads(ciphertext)
except (InvalidToken, TypeError):
self.reset()
return None
评论列表
文章目录