- TOKEN_KEY = "0M6W0U1IXexThi5idy8mnkqPKEq1LtEnlK/pZSn0cDrN"
-
- data = {}
- data["user"] = username
- data["machine"] = machine.name
- data["expires"] = time.time()+(5*60)
- pickled_data = cPickle.dumps(data)
- m = hmac.new(TOKEN_KEY, digestmod=sha)
- m.update(pickled_data)
- token = {'data': pickled_data, 'digest': m.digest()}
- token = cPickle.dumps(token)
- token = base64.urlsafe_b64encode(token)