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
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)
def __init__(self, client, auto_close=True): BaseSession.__init__(self, auto_close=auto_close) self.ssh_client = client self.sftp = client.open_sftp()