Reputation: 33824
I've been looking around for a module which allows me to do SSH / SFTP functions in python without using POPEN to do it manually. Is there anything like this? I haven't found any real information on this, thanks!
Upvotes: 11
Views: 21254
Reputation: 83177
For SFTP, you can use pysftp, which is a thin wrapper over paramiko's SFTPClient (pip install sftp
).
Example 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)
sftp.get('/data/word_vectors/GoogleNews-vectors-negative300.txt', preserve_mtime=True)
print('done')
Upvotes: 2
Reputation: 11
Depending on what you're looking to do over ssh, you might also benefit from looking at the pexpect library: http://www.noah.org/wiki/pexpect
Upvotes: 1