, , exec_command() :
self.ssh.exec_command('ls', timeout=5)
, :
def check_connection(self):
"""
This will check if the connection is still availlable.
Return (bool) : True if it still alive, False otherwise.
"""
try:
self.ssh.exec_command('ls', timeout=5)
return True
except Exception as e:
print "Connection lost : %s" %e
return False
5 .