~justin-fathomdb/nova/justinsb-openstack-api-volumes

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/doc/core/howto/listings/pb/pb6client1.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env python
 
2
 
 
3
# Copyright (c) 2009 Twisted Matrix Laboratories.
 
4
# See LICENSE for details.
 
5
 
 
6
from twisted.spread import pb
 
7
from twisted.internet import reactor
 
8
from twisted.cred import credentials
 
9
 
 
10
def main():
 
11
    factory = pb.PBClientFactory()
 
12
    reactor.connectTCP("localhost", 8800, factory)
 
13
    def1 = factory.login(credentials.UsernamePassword("user1", "pass1"))
 
14
    def1.addCallback(connected)
 
15
    reactor.run()
 
16
 
 
17
def connected(perspective):
 
18
    print "got perspective1 ref:", perspective
 
19
    print "asking it to foo(13)"
 
20
    perspective.callRemote("foo", 13)
 
21
 
 
22
main()