A friendly face on SFTP
A simple interface to SFTP. The module offers high level abstractions and task based routines to handle your SFTP needs. Checkout the Cook Book, in the docs, to see what pysftp can do for you.
::
import pysftp
with pysftp.Connection('hostname', username='me', password='secret') as sftp:
with sftp.cd('public'): # temporarily chdir to public
sftp.put('/my/local/filename') # upload file to public/ on remote
sftp.get('remote_file') # get a remote file
Tested on Python 2.7, 3.2, 3.3, 3.4
.. image:: https://drone.io/bitbucket.org/dundeemt/pysftp/status.png :target: https://drone.io/bitbucket.org/dundeemt/pysftp/latest :alt: Build Status
0.2.9 (current, released 2016-07-04)
pysftp.CnOpts.hostkeyspysftp.Connection.remote_server_key - used to retrieve the
remote hosts server key.compression (J. Kruth).active_compression, to return the active local and remote compression settings as a tuplelog parameter of Connection to the new CnOpts connection options object, deprecated the existing log parameter, will be removed in 0.3.0pysftp.Conection.walktree to always use posixpath conventions when walking a remote directory per the latest draft-ietf-secsh-filexfer-13.txt. Issue encountered with windows clients (#60)pysftp.reparent to handle mis-matched pathing, i.e. windows -> posix, better (#61)0.2.8 (released 2014-05-28)
pysftp.walktree for walking local directories.pysftp.Connection.walktree to allow it to do another trick.put_d to put the contents of a local directory to a remote onepysftp.Connection.cd.put_r to recursively put the contents of a local directory to a remote one.st_mode_to_int on py3 (#52).listdir_attr now returns a sorted list, sorted on filenamepysftp.cd with-context version of os.chdir for local directories0.2.7 (released 2014-05-24)
pysftp.Connection.walktree, recursively walk, depth first, a remote directory structure. Used as the base of .get_r. See tests/test_walktree.py for examples..unlink as synonym for .remove.normalize.get_r to recursively copy remote directories to a local path.pwd to return the current working directory.cwd as synonym for .chdir.listdir to return a sorted list instead of an arbitrary one.readlink, always returns an absolute path.get_d to copy the remote directory to a local path (non-recursive).timeout to set the read/write timeout of the underlying channel for pending read/write ops.listdir_attr, wrapper for paramiko method.truncate, method returns the new file size0.2.6 (released 2014-05-17)
preserve_mtime parameter to .put, optionally updates the remote file's st_mtime to match the local file.preserve_mtime parameter to .get, optionally updates the local file's st_mtime to match the remote file.exists and .lexists, use .stat and .lstat respectively.symlink.isdir, .isfile, .makedirs.chmod.chown.sftp_client which exposes underlying, active SFTPClient object for advance use0.2.5 (released 2014-05-15)
ciphers parameter to .Connection object (D. Reilly).active_ciphers to return local and remote cipher in use.security_options, where you can get available ciphers, among other information0.2.4 (released 2014-05-13)
.Connection can be used in a with statement.remove.put.get.openparamiko.AgentKey to be passed in as the private_key for Connection.mkdir.rmdir.stat and .lstat.st_mode_to_int,to convert the st_mode value back into a common integer representation.getfo.putfo0.2.3 (released 2014-05-10)
0.2.2
additions