def get(self, vserver): username = request.authorization.username password = request.authorization.password tn = api.connectToTelnet(HOST, PORT, vserver, username, password, '') clientlist = api.getClientList(tn) content = {'total': len(clientlist), 'items': clientlist} return jsonify(content)
def get(self, vserver, command): username = request.authorization.username password = request.authorization.password tn = api.connectToTelnet(HOST, PORT, vserver, username, password, '') response = { 'response': api.sendCommand(command, request.args, tn, True) } return jsonify(response)
def get(self, clid, vserver): username = request.authorization.username password = request.authorization.password message = '' nickname = '' if hasattr(request, 'args'): if 'msg' in request.args: message = request.args['msg'] if 'nickname' in request.args: nickname = request.args['nickname'] tn = api.connectToTelnet(HOST, PORT, vserver, username, password, nickname) return jsonify(api.pokeClient(clid, tn, message))
def main(): HOST = 'host' PORT = '10011' USER = '******' PASS = '******' tn = api.connectToTelnet(HOST, PORT, USER, PASS) list_of_channels = api.getChannelList(tn) print api.getChannelByCid(8, list_of_channels)['channel_name'] for client in api.getClientList(tn): if client['client_type'] != '0': continue print (str(client['client_nickname']) + ' - ' + str(api.getChannelByCid(client['cid'], list_of_channels)['channel_name']))
def get(self, clid, vserver): username = request.authorization.username password = request.authorization.password tn = api.connectToTelnet(HOST, PORT, vserver, username, password, '') return jsonify(api.getClientByClid(clid, api.getClientList(tn)))