I am using the below code:
import paramiko
def runSshCmd(hostname, username, password, cmd, timeout=None):
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostname, username=username, password=password,
allow_agent=False, look_for_keys=False, timeout=timeout)
stdin, stdout, stderr = client.exec_command(cmd)
stdin.flush()
data = stdout.read()
print (data)
client.close()
runSshCmd("10.128.12.32", "root", "C0mput3Gr!d", "ts_menu")
when it comes to stdout.read() , it hangs... sometimes it prints the output after long time.
Can you please suggest if anything can be done about this issue??
I see this issue has been reported in :
https://bugs.python.org/issue24026
Is there any better module in python for ssh connection and run commands ??