2 if __name__ == '__main__':
4 raise SystemExit(command_client.main())
8 from twisted.python.log import startLogging, err
9 from twisted.protocols.amp import Integer, String, Unicode, Command
10 from twisted.internet import reactor
12 from basic_client import connect
14 class UsernameUnavailable(Exception):
18 class RegisterUser(Command):
19 arguments = [('username', Unicode()),
20 ('publickey', String())]
22 response = [('uid', Integer())]
24 errors = {UsernameUnavailable: 'username-unavailable'}
31 def connected(protocol):
32 return protocol.callRemote(
35 publickey='ssh-rsa AAAAB3NzaC1yc2 alice@actinium')
36 d.addCallback(connected)
38 def registered(result):
39 print 'Registration result:', result
40 d.addCallback(registered)
42 d.addErrback(err, "Failed to register")
44 def finished(ignored):
46 d.addCallback(finished)