Exemple #1
0
def get_user(userid=''):
    """
    GET /user
    Gets a user.

    The user's private properties are not returned unless you pass a correct collection key.
    """

    key = request.args.get("key")
    try:
        user = UserFactory.get(userid, mydao, key)
    except KeyError:
        abort(404, "User doesn't exist.")
    except NotAuthenticatedError:
        abort(403, "You've got the wrong password.")

    resp = make_response(json.dumps(user, indent=4), 200)
    resp.mimetype = "application/json"
    return resp