def xmlrpc(request):
    url = settings.NAGIOS_XMLRPC_URL
    command = request.GET.get('command')

    args = request.GET.get('args')
    if args:
        args = json.loads(args)
    else:
        args = []

    socket.setdefaulttimeout(10)
    try:
        server = xmlrpclib.ServerProxy(url)
        result = getattr(server, command)(*args)
        return HttpResponse(repr(result))
    except xmlrpclib.Fault, ex:
        return HttpResponse('xmlrpc fault: %s' % ex.faultString, status=500)
    except xmlrpclib.Error, ex:
        return HttpResponse('xmlrpc error: %s' % ex, status=500)
    except socket.error, ex:
        return HttpResponse('socket error: %s' % ex, status=500)
dataset/ETHPy150Open marineam/nagcat/railroad/railroad/ajax/xmlrpc.py/xmlrpc/original