예제 #1
0
파일: xmlrpc2scgi.py 프로젝트: serbra/ru
def main(argv):
    output_python = False

    if argv[0] == '-p':
        output_python = True
        argv.pop(0)

    host, methodname = argv[:2]

    respxml = do_scgi_xmlrpc_request(host, methodname,
                                     convert_params_to_native(argv[2:]))
    #~ respxml = RTorrentXMLRPCClient(host, methodname)(convert_params_to_native(argv[2:]))

    if not output_python:
        print respxml
    else:
        print xmlrpclib26.loads(respxml)[0][0]
예제 #2
0
def main(argv):
    output_python=False
    
    if argv[0] == '-p':
        output_python=True
        argv.pop(0)
    
    host, methodname = argv[:2]
    
    respxml = do_scgi_xmlrpc_request(host, methodname,
                                    convert_params_to_native(argv[2:]))
    #~ respxml = RTorrentXMLRPCClient(host, methodname)(convert_params_to_native(argv[2:]))
    
    if not output_python:
        print respxml
    else:
        print xmlrpclib26.loads(respxml)[0][0]
예제 #3
0
파일: xmlrpc2scgi.py 프로젝트: serbra/ru
def do_scgi_xmlrpc_request_py(host, methodname, params=()):
    """
        Send an xmlrpc request over scgi to host.
        host:       scgi://host:port/path
        methodname: xmlrpc method name
        params:     tuple of simple python objects
        returns:    xmlrpc response converted to python
    """
    xmlresp = do_scgi_xmlrpc_request(host, methodname, params)
    return xmlrpclib26.loads(xmlresp)[0][0]
예제 #4
0
def do_scgi_xmlrpc_request_py(host, methodname, params=()):
    """
        Send an xmlrpc request over scgi to host.
        host:       scgi://host:port/path
        methodname: xmlrpc method name
        params:     tuple of simple python objects
        returns:    xmlrpc response converted to python
    """
    xmlresp = do_scgi_xmlrpc_request(host, methodname, params)
    return xmlrpclib26.loads(xmlresp)[0][0]
예제 #5
0
파일: xmlrpc2scgi.py 프로젝트: serbra/ru
 def __call__(self, *args):
     #~ print "%s%r"%(self.methodname, args)
     scheme, netloc, path, query, frag = urlparse.urlsplit(self.url)
     xmlreq = xmlrpclib26.dumps(args, self.methodname)
     if scheme == 'scgi':
         xmlresp = SCGIRequest(self.url).send(xmlreq)
         return xmlrpclib26.loads(xmlresp)[0][0]
         #return do_scgi_xmlrpc_request_py(self.url, self.methodname, args)
     elif scheme == 'http':
         raise Exception('Unsupported protocol')
     elif scheme == '':
         raise Exception('Unsupported protocol')
     else:
         raise Exception('Unsupported protocol')
예제 #6
0
 def __call__(self, *args):
     #~ print "%s%r"%(self.methodname, args)
     scheme, netloc, path, query, frag = urlparse.urlsplit(self.url)
     xmlreq = xmlrpclib26.dumps(args, self.methodname)
     if scheme == 'scgi':
         xmlresp = SCGIRequest(self.url).send(xmlreq)
         return xmlrpclib26.loads(xmlresp)[0][0]
         #return do_scgi_xmlrpc_request_py(self.url, self.methodname, args)
     elif scheme == 'http':
         raise Exception('Unsupported protocol')
     elif scheme == '':
         raise Exception('Unsupported protocol')
     else:
         raise Exception('Unsupported protocol')