Exemplo n.º 1
0
def page_api_stats_server(id):
    if not util.get_server(id):
        return abort(404)

    try:
        return jsonify(util.fetch_server_status(id))
    except Exception as E:
        return jsonify({"error": str(E)})
Exemplo n.º 2
0
def page_api_stats():
    try:
        d = {}

        for server in cfg.SERVERS:
            if server["open"]:
                try:
                    d[server["id"]] = util.fetch_server_status(server["id"])
                except Exception as E:
                    d[server["id"]] = {"error": str(E)}

        return jsonify(d)

    except Exception as E:
        return jsonify({"error": str(E)})