[Twisted-Python] Sending commands when using Telnet client
donwsmith at gmail.com
Tue Feb 28 17:26:03 EST 2006
Thank you, thank you, thank you!!!
On 2/28/06, Jean-Paul Calderone <exarkun at divmod.com> wrote:
> On Tue, 28 Feb 2006 10:59:50 -0800, Don Smith <donwsmith at gmail.com> wrote:
> >Yes, I'm sort of a Twisted newbie, so maybe this has an obvious answer,
> >I'm just not seeing it.
> >I have a Twisted program that I need to add in the ability to make a
> >telnet connection to a remote server and send some commands to it and
> >with the data received.
> > [snip]
> >This all works great, except that the command sequence is hard coded in
> >TelnetClient class. I want to be able to reference the "cmd" parameter,
> >which could be a list of commands to iterate over,etc. But I don't see
> how I
> >can access the "cmd" parameter that gets passed into the TelnetConnection
> >class from within the TelnetClient class.
> >I'm really desparate for some help, I've been racking my brain on this
> >yesterday morning.
> The usual approach is to save the data (`cmd' in this case) on the factory
> and use `self.factory.stuff' from the protocol. The `factory' attribute is
> set on the protocol class by the default `buildProtocol' implementation. It
> is not available in the protocol's `__init__', but is available by the time
> `connectionMade' is called.
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Twisted-Python