Implement indexing into Apache Druid #1
17
api/views.py
17
api/views.py
|
@ -294,6 +294,21 @@ class API(object):
|
|||
main.saveConf("network")
|
||||
return dumps({"success": True})
|
||||
|
||||
@app.route("/irc/network/<net>/<num>/", methods=["PUT"])
|
||||
@login_required
|
||||
def irc_network_relay_add(self, request, net, num):
|
||||
if net not in main.network.keys():
|
||||
return dumps({"success": False, "reason": "no such net."})
|
||||
if not num.isdigit():
|
||||
return dumps({"success": False, "reason": "invalid num: not a number."})
|
||||
num = int(num)
|
||||
net_inst = main.network[net]
|
||||
if num in net_inst.relays:
|
||||
return dumps({"success": False, "reason": "network already has this relay."})
|
||||
id, alias = net_inst.add_relay()
|
||||
main.saveConf("network")
|
||||
return dumps({"success": True, "id": id, "alias": alias})
|
||||
|
||||
@app.route("/irc/network/<net>/channels/", methods=["POST"])
|
||||
@login_required
|
||||
def irc_network_channels(self, request, net):
|
||||
|
@ -328,7 +343,7 @@ class API(object):
|
|||
return dumps({"success": False, "reason": "no such net."})
|
||||
joined = chankeep.joinSingle(net, channel)
|
||||
if not joined:
|
||||
dumps({"success": False, "reason": "no channels joined."})
|
||||
return dumps({"success": False, "reason": "could not allocate channel to relay."})
|
||||
return dumps({"success": True, "relays": joined})
|
||||
|
||||
@app.route("/aliases/", methods=["GET"])
|
||||
|
|
Loading…
Reference in New Issue