1 from twisted.internet import reactor
2 from twisted.cred import credentials
3 from twisted.spread import pb
4 from twisted.python import log
7 """A class to manage a remote connection to the buildbot server."""
14 def connect(self, host, port, username, password):
16 cf = pb.PBClientFactory()
17 creds = credentials.UsernamePassword(username, password)
20 reactor.connectTCP(host, port, cf)
22 d.addCallbacks(self.connected, lambda arg: log.err(arg))
24 log.msg('connecting to %s:%d as %s' % (host, port, username))
28 def connected(self, ref):
32 # Remote reference is a StatusClientPerspective object.
35 self.remote.notifyOnDisconnect(self.disconnected)
37 def disconnected(self, ref):
39 log.msg('disconnected')
43 def subscribe(self, mode, interval, target):
44 return self.remote.callRemote('subscribe', mode, interval, target)