@app.route('/state_log/<hostname>/<checkname>', methods=['GET'])
@login_required
def state_log_by_check(hostname, checkname):
    """Get check history for a given check on a given host"""
    if request.method == 'GET':
        try:
            limit = request.args.get('limit', 10, type=int)
        except __HOLE__:
            abort(400)
        log = list(r.table("state_log").filter({"hostname": hostname, "check": checkname}).order_by(r.desc("last")).limit(limit).run(rdb.conn))
        if log:
            return jsonify({'state_log': sorted(log, key=lambda k: k['last'])})
        else:
            abort(404)
    else:
        abort(400)
dataset/ETHPy150Open pandemicsyn/stalker/stalkerweb/stalkerweb/views.py/state_log_by_check