您的位置:首页 > 大数据 > 人工智能

the main methos of class Ssh in pyssh module

2012-06-12 18:28 253 查看


Package pymeterlib :: Module pyssh ::
Class Ssh

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.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐