#! /usr/bin/python # -*- Mode: Python -*- # vi:si:et:sw=4:sts=4:ts=4 from twisted.spread import pb from twisted.internet import reactor from twisted.cred import credentials class Component(pb.Referenceable): def remote_succeed(self, source): print "%s asked me to succeed" % source def remote_fail(self, source): print "%s asked me to fail, going to raise pb.Error, I failed" % source raise pb.Error, "I failed" def main(): factory = pb.PBClientFactory() reactor.connectTCP("localhost", 8900, factory) def1 = factory.login(credentials.UsernamePassword("component", "pass"), Component()) def1.addCallback(connected) reactor.run() def connected(perspective): print "got perspective ref:", perspective print "asking it if it's ready" perspective.callRemote("ready") main()