Package pymeterlib :: Module pyssh :: Class Ssh
[show private | hide private]
[frames | no frames]

Class Ssh


A SSH connection class.
Method Summary
  __init__(self, username, host, port)
Constructor.
  __del__(self)
Destructor -- close the connection.
  close(self, addnewline)
Close the ssh connection by closing the input and output pipes.
  login(self, password, logintext)
Logs in to the ssh host.
  logout(self)
Logs out the session.
  open(self, cmd)
Opens a ssh connection.
  read_all(self)
Reads until end of file hit.
  read_lazy(self)
Lazy read from sshout.
  read_some(self)
Always read at least one block, unless the connection is closed.
  read_very_lazy(self)
Very lazy read from sshout.
  sendcmd(self, cmd, readtype)
Sends the command 'cmd' over the ssh connection, and returns the result.
  sig_handler(self, signum, stack)
Handle SIGCHLD signal
  write(self, text)
Send text to the ssh process.

Method Details

__init__(self, username=None, host='localhost', port=None)
(Constructor)

Constructor. This does not try to connect.

__del__(self)
(Destructor)

Destructor -- close the connection.

close(self, addnewline=1)

Close the ssh connection by closing the input and output pipes. Returns the closing messages.

On Posix systems, by default it adds a newline before sending the disconnect escape sequence. Turn this off by setting addnewline=0.

login(self, password, logintext='Last login:')

Logs in to the ssh host. Checks for standard prompts, and calls the function passed as promptcb to process them. Returns the login banner, or 'None' if login process aborted.

logout(self)

Logs out the session.

open(self, cmd=None)

Opens a ssh connection.

Raises an error if attempting to open an already open connection.

read_all(self)

Reads until end of file hit. May block.

read_lazy(self)

Lazy read from sshout. Waits a little, but does not block.

read_some(self)

Always read at least one block, unless the connection is closed. My block.

read_very_lazy(self)

Very lazy read from sshout. Just reads from text already queued.

sendcmd(self, cmd, readtype=1)

Sends the command 'cmd' over the ssh connection, and returns the result. By default it uses read_some, which may block.

sig_handler(self, signum, stack)

Handle SIGCHLD signal

write(self, text)

Send text to the ssh process.

Generated by Epydoc 2.1 on Fri Mar 17 09:16:19 2006 http://epydoc.sf.net