[paramiko] How to use settimeout with from_transport
Manpreet Singh Khurana
manpreetsk at gmail.com
Thu Mar 15 09:50:00 PDT 2007
Hi
I have a simple utility which opens SSH connection to remote server by using
t = paramiko.Transport((hostname, port))
and then doing connect by
t.connect(username=username, password=password, hostkey=hostkey)
The i am using SFTPClient to open an sftp session across an open ssh
Transport and do remote file operations.
sftp = paramiko.SFTPClient.from_transport(t)
Now with this SFTP Client object i am opening a file on the remote server
rPath= sftp.file(fileName, 'rb')
and reading the file from this path
data = rPath.read(32768)
Now I want to use the settimeout API to set the timeout value of this
socket so that id the read operation takes time more than the
configured value we should be
able to timeout that socket
How can this be done
Can i use sftp.settimeout(60) directly
Do we have a sample code to understand the usage
Can somebody tell me how this is done.
This is urgent, please help.
MSK
More information about the paramiko
mailing list