def loadd(data): d = ebdecode(data) if d['y'] == 'e': raise DFault(d['c'], d['s'], d['t']) elif d['y'] == 'r': return d['r'], None, d['t'] elif d['y'] == 'q': return d['a'], d['q'], d['t'] raise ValueError
def loads(data): d = ebdecode(data) if d['y'] == 'e': raise Fault(d['c'], d['s']) # the server raised a fault elif d['y'] == 'r': # why is this return value so weird? # because it's the way that loads works in xmlrpclib return (d['r'], ), None elif d['y'] == 'q': return d['a'], d['q'] raise ValueError
def loads(data): d = ebdecode(data) if d['y'] == 'e': raise Fault(d['c'], d['s']) # the server raised a fault elif d['y'] == 'r': # why is this return value so weird? # because it's the way that loads works in xmlrpclib return (d['r'],), None elif d['y'] == 'q': return d['a'], d['q'] raise ValueError
def payloadReceived(self, payload): payload = ebdecode(payload) print 'listener got:', payload assert payload == {'a': [[1002], {}], 'q': 'ping', 'y': 'q'}
def __init__(self, filename): data = open(filename, 'rb').read() self.data = ebdecode(data)