pysftp's get()
method sometime hangs.
For example if I execute the following to download a file:
import pysftp #pip install sftp
import sys
hostname = "128.65.45.12"
username = "bob"
password = "123456"
sftp = pysftp.Connection(hostname, username=username, password=password)
while True:
sftp.get('/data/word_vectors/GoogleNews-vectors-negative300.txt', preserve_mtime=True)
print('done')
It may display a few "done", i.e. download the file a few times, but then hangs for ever (while the server is still responsive). How can I set a timeout for pysftps' get() to restart it if it hangs?