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