[Twisted-Python] Using twisted.conch

pico pico at trispen.com
Thu Mar 22 14:08:50 EDT 2007


Hi all.

I'm struggling a bit with twisted.conch.
I've read the howto at 
http://twistedmatrix.com/projects/conch/documentation/howto/conch_client.html.
I can understand this example fine.
For a simple application, it works fine to subclass SSHChannel and 
implement all the code in that classes methods.
However I would like to be able to implement something as follows:

class SSHWrapper:
    def connect(self,hostname,username,password):
       #Create SshTransport object
    def runCommand(self,command)
       #Use SshChannel object to run command, return a deferred
    def disconnect(self):
       #Cleanup

The problem is that, due to the ClientFactory creating instances of the 
relevant objects for you (SSHClientTransport,SSHUserAuthClient,etc), you 
are left without a reference to the SSHChannel object,required to run 
the command.

Is there any way to get the SSHChannel object from the 
SSHClientTransport instance.
Any advice with this matter would be appreciated.

Thanks
Pico




More information about the Twisted-Python mailing list