示例#1
0
 def __init__(self, client, sftp=True, auto_close=True):
     BaseSession.__init__(self, auto_close=auto_close)
     self.ssh_client = client
     if sftp:
         self.sftp = client.open_sftp()
     else:
         self.sftp = None
示例#2
0
    def __str__(self):
        username = getattr(self.ssh_client, 'username', None)
        hostname = getattr(self.ssh_client, 'hostname', None)

        if username and hostname:
            return "<SshSession %s@%s>" % (username, hostname)
        elif hostname:
            return "<SshSession %s>" % hostname
        return BaseSession.__str__(self)
示例#3
0
    def __str__(self):
        username = getattr(self.ssh_client, 'username', None)
        hostname = getattr(self.ssh_client, 'hostname', None)

        if username and hostname:
            return "<SshSession %s@%s>" % (username, hostname)
        elif hostname:
            return "<SshSession %s>" % hostname
        return BaseSession.__str__(self)
示例#4
0
文件: ssh.py 项目: coder46/rcontrol
 def __init__(self, client, auto_close=True):
     BaseSession.__init__(self, auto_close=auto_close)
     self.ssh_client = client
     self.sftp = client.open_sftp()
示例#5
0
 def __init__(self, client, auto_close=True):
     BaseSession.__init__(self, auto_close=auto_close)
     self.ssh_client = client
     self.sftp = client.open_sftp()