コード例 #1
0
ファイル: pbsupport.py プロジェクト: levanhong05/MeshMagic
 def _cbConnected(self, root, chatui):
     print 'Connected!'
     print 'Identifying...',
     d = pb.authIdentity(root, self.username, self.password)
     d.addCallbacks(self._cbIdent, self._ebConnected,
                    callbackArgs=(chatui,))
     return d
コード例 #2
0
 def _cbConnected(self, root, chatui):
     print('Connected!')
     print('Identifying...', end=' ')
     d = pb.authIdentity(root, self.username, self.password)
     d.addCallbacks(self._cbIdent, self._ebConnected,
                    callbackArgs=(chatui,))
     return d
コード例 #3
0
    def remote_ring(self, callerID):
        print "Your phone is ringing.  It's a call from", callerID


bugClient = BugClient()
phoneClient = CellClient()

# Log-In Information
username = "******"
password = "******"
bugName = "franz"
phoneNumber = "222-303-8485"

# A little magic to get us connected...
getObjectAt("localhost", portno).addCallback(
    # challenge-response authentication
    lambda r: authIdentity(r, username, password)
).addCallback(
    # connecting to each perspective with 'attach' method of remote identity
    lambda i: DeferredList([
        i.callRemote("attach", "metamorph", bugName, bugClient),
        i.callRemote("attach", "cellphone", phoneNumber, phoneClient)
    ])
    # connecting perspectives to client-side objects
).addCallback(lambda l: (bugClient.gotPerspective(l[0][1]),
                         phoneClient.gotPerspective(l[1][1])))

reactor.callLater(5, reactor.stop)  # In five seconds, log out.
reactor.run()  # Start the main loop.