2 from twisted.internet.defer import Deferred
3 from xmlrpcclient import XMLRPCClientFactory as factory
4 from const import reactor
5 from base64 import encodestring as encode
8 def ping(self, sender):
10 f = factory('ping', (sender,), df.callback, df.errback)
11 reactor.connectTCP(self.host, self.port, f)
13 def findNode(self, target, sender):
15 f = factory('find_node', (target, sender), df.callback, df.errback)
16 reactor.connectTCP(self.host, self.port, f)
18 def storeValue(self, key, value, sender):
20 f = factory('store_value', (encode(key), encode(value), sender), df.callback, df.errback)
21 reactor.connectTCP(self.host, self.port, f)
23 def findValue(self, key, sender):
25 f = factory('find_value', (encode(key), sender), df.callback, df.errback)
26 reactor.connectTCP(self.host, self.port, f)