Пример #1
0
def exampleActiveFds():
    i = 0
    c = xmlrpc.client('localhost', PORT, '/blah')
    c.nbExecute('echo', ['hello', 'world'], activeFdCall, i)
    c.work(0.0)
    while 1:
        (inFd, outFd, excFd) = c.activeFds()
        select.select(inFd, outFd, excFd)
        c.work(0.0)
Пример #2
0
 def __talk__(self, command, *args):
     args = filter(lambda x, y=NONE: (x is not y), args)
     if not self.client:
         raise ClientError(ERR_CLOSE)
     try:
         return self.client.execute(command, args, timeout=self.timeout)
     except:
         self.client = xmlrpc.client(self.host, self.port)
         return self.client.execute(command, args, timeout=self.timeout)
Пример #3
0
 def __init__(self, host, port, timeout=-1.0):
     self.host = host  # host
     self.port = port  # server port
     self.timeout = timeout  # xmlrpc timeout
     self.client = xmlrpc.client(host, port)
     xmlrpc.setLogLevel(LOG_LEVEL)
     self.cmds = self.__talk__('getclient')
     if not self.cmds:
         raise ClientError('could not get command list')
Пример #4
0
def exampleFault():
    try:
        c = xmlrpc.client('localhost', PORT, '/blah')
        print(c.execute('fault', ['Hello, World!']))
    except xmlrpc.fault as f:
        sys.stderr.write('xmlrpc fault occurred:\n')
        sys.stderr.write('faultCode is: %s\n' % f.faultCode)
        sys.stderr.write('faultString is: %s\n' % f.faultString)
        traceback.print_exc()
        sys.exit(0)
    else:
        sys.stderr.write('xmlrpc fault test failed\n')
        sys.exit(1)
Пример #5
0
#!/usr/local/bin/python2.0 -O

import sys
import turbo_xmlrpc as xmlrpc

if len(sys.argv) != 3:
    sys.stderr.write('usage: %s host port\n' % sys.argv[0])
    sys.exit(0)

host = sys.argv[1]
port = int(sys.argv[2])

c = xmlrpc.client(host, port)
xmlrpc.setLogLevel(0)

print c.execute('kill', [])
c = None
Пример #6
0
def exampleRequestExit():
    c = xmlrpc.client('localhost', PORT, '/blah')
    print(c.execute('exit', []))
Пример #7
0
def examplePostpone():
    c = xmlrpc.client('localhost', PORT, '/blah')
    print(c.execute('postpone', ['Hello, World!']))
Пример #8
0
def exampleClient():
    c = xmlrpc.client('localhost', PORT, '/blah')
    print(c.execute('echo', ['Hello, World!']))
Пример #9
0
def exampleNbClient():
    c = xmlrpc.client('localhost', PORT)
    r = c.nbExecute('echo', ['hello', 'world'], callback, 'Extra Args')
    c.work(10)
Пример #10
0
def exampleAuthClient():
    c = xmlrpc.client('localhost', PORT, '/blah')
    print(c.execute('echo', ['Hello, World!'], 1.0, TEST_NAME, TEST_PASS))
Пример #11
0
 def reconnect(self):
     self.client = xmlrpc.client(self.host, self.port)