def validate_token(token): signer = TimestampSigner(settings.SECRET_KEY) decoded_string = base64.b64decode(token) try: output = signer.unsign(decoded_string, settings.TOKEN_SIGNING_TIMELIMIT) except BadSignature, e: return False
def generate_signed_token(input): signer = TimestampSigner(settings.SECRET_KEY) signed_string = signer.sign(input) return base64.b64encode(signed_string)