host.telnet¶
Telnet client for remote host connections.
TelnetClient handles the transport-level concerns: opening a telnet connection, negotiating protocol options (echo suppression), authenticating, and optionally sending NAWS (window-size) updates on SIGWINCH so remote TUIs reflow like they do under SSH. After login the reader/writer streams are handed off to a TelnetSession for command execution.
- class otto.host.telnet.TelnetClient(host, user, password, options=<factory>, prompt=None, connect_port=None)¶
Bases:
object- host : --is-rst--:py:class:`str`¶
- user : --is-rst--:py:class:`str`¶
- password : --is-rst--:py:class:`str`¶
- options : --is-rst--:py:class:`~otto.host.options.TelnetOptions`¶
Connection options. Default reproduces otto’s historical behavior.
-
prompt : --is-rst--:py:data:`~typing.Optional`\ \[:py:class:`str`] =
None¶ Shell prompt string the device displays after each command (e.g. ‘$ ‘ or ‘# ‘). Used during login to confirm authentication succeeded.
-
connect_port : --is-rst--:py:data:`~typing.Optional`\ \[:py:class:`int`] =
None¶ Override port for ConnectionManager’s tunneled case. When None,
options.portis used. Keeps tunnel port-forwarding transparent to the TelnetOptions carried through the rest of the stack.
-
reader : --is-rst--:py:data:`~typing.Any` =
None¶
-
writer : --is-rst--:py:data:`~typing.Any` =
None¶
-
async connect(interactive=
False)¶ Open the telnet connection, negotiate options, and log in.
- Parameters:¶
interactive – When True, skip the
DONT ECHOnegotiation so the remote shell echoes keystrokes back — required forotto.host.interact.run_telnet_login()so the user sees what they type. Non-interactive callers (the default) getDONT ECHOso command echoes don’t mix with captured output.- Return type:¶
None