def create_token(key, payload):
  """Auth token generator

  payload should be a json encodable data structure
  """
  token = hmac.new(key)
  token.update(json.dumps(payload))
  return token.hexdigest()
def create_token ( key , payload ) : token = hmac . new ( key ) token . update ( json . dumps ( payload ) ) return token . hexdigest ( )
Auth token generator

  payload should be a json encodable data structure