Re: [Twisted-Python] Perspective / Client confusion
![](https://secure.gravatar.com/avatar/dd9ef248138ccdba939c8c9f483fc10d.jpg?s=120&d=mm&r=g)
On Friday 30 May 2003 02:36 am, Luc Stepniewski wrote:
If you look at twisted.spread.pb you'll see that the pb.connect() function takes both a username (same as identity.name) and perspectiveName as parameters: def connect(host, port, username, password, serviceName, perspectiveName=None, client=None, timeout=None): """Connects and authenticates, then retrieves a PB service. Required arguments: - host -- the host the service is running on - port -- the port on the host to connect to - username -- the name you will be identified as to the authorizer - password -- the password for this username - serviceName -- name of the service to request Optional (keyword) arguments: - perspectiveName -- the name of the perspective to request, if different than the username - client -- XXX the \"reference\" argument to perspective.Perspective.attached - timeout -- see twisted.internet.tcp.Client @returns: A Deferred instance that gets a callback when the final Perspective is connected, and an errback when an error occurs at any stage of connecting. """ So my demo/hack client application supplies those details when a user logs on: def main(self): name = raw_input('Enter your login name (root): ') if not name: name = 'root' password = raw_input('Enter your password (password): ') if not password: password = 'password' perspective = raw_input('Enter your perspective (root:admin): ') if not perspective: perspective = 'root:admin' df = pb.connect(host='localhost', port=8789, username=name, password=password, serviceName='BankingService', perspectiveName=perspective, client=self, timeout=30) df.addCallbacks(self.gotPerspective, self.noPerspective) reactor.run() -- Patrick K. O'Brien Orbtech http://www.orbtech.com/web/pobrien ----------------------------------------------- "Your source for Python programming expertise." -----------------------------------------------
participants (1)
-
Patrick K. O'Brien