Skip to main content

A friendly face on SFTP

Project description

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'public')              # temporarily chdir to public
        sftp.put('/my/local/filename')  # upload file to public/ on remote

    sftp.get_r('myfiles', '/backup')    # recursively copy myfiles/ to local


Tested on Python 2.7, 3.2, 3.3

Believed to support Python 3.4

Change Log

  • 0.2.8 (current, released 2014-05-28)
    • created pysftp.walktree for walking local directories
    • added param recurse to .pysftp.Connection.walktree to allow it to do another trick
    • created .put_d to put the contents of a local directory to a remote one
    • created a context manager chdir method,
    • created .put_r to recursively put the contents of a local directory to a remote one
    • fixed a bug with .st_mode_to_int on py3 (#52)
    • .listdir_attr now returns a sorted list, sorted on filename
    • created with-context version of os.chdir for local directories
    • created docs, cookbook to show off some of the notable features of pysftp
  • 0.2.7 (released 2014-05-24)
    • created pysftp.Connection.walktree, recursively walk, depth first, a remote directory structure. Used as the base of .get_r. See tests/ for examples.
    • added .unlink as synonym for .remove
    • added .normalize
    • created .get_r to recursively copy remote directories to a local path
    • created .pwd to return the current working directory
    • created .cwd as synonym for .chdir
    • modified .listdir to return a sorted list instead of an arbitrary one
    • added .readlink, always returns an absolute path
    • created .get_d to copy the remote directory to a local path (non-recursive)
    • added .timeout to set the read/write timeout of the underlying channel for pending read/write ops
    • added .listdir_attr, wrapper for paramiko method
    • added .truncate, method returns the new file size
    • improved DRY’ness of test suite
  • 0.2.6 (released 2014-05-17)
    • added preserve_mtime parameter to .put, optionally updates the remote file’s st_mtime to match the local file.
    • added preserve_mtime parameter to .get, optionally updates the local file’s st_mtime to match the remote file
    • added .exists and .lexists, use .stat and .lstat respectively
    • added .symlink
    • created .isdir, .isfile, .makedirs
    • added .chmod
    • added .chown
    • added .sftp_client which exposes underlying, active SFTPClient object for advance use
  • 0.2.5 (released 2014-05-15)
    • added ciphers parameter to .Connection object (D. Reilly)
    • added .active_ciphers to return local and remote cipher in use
    • added .security_options, where you can get available ciphers, among other information
    • enhanced logging, and added documentation and tests
  • 0.2.4 (released 2014-05-13)
    • .Connection can be used in a with statement
    • add .remove
    • added support for callback and confirm params to .put
    • added support for callback on .get
    • added support for .open
    • fixed password bug and now differentiates between an empty string and None
    • added support for paramiko.AgentKey to be passed in as the private_key for Connection
    • added support for .mkdir
    • added support for .rmdir
    • added support for .stat and .lstat
    • added helper function, .st_mode_to_int,to convert the st_mode value back into a common integer representation
    • added .getfo
    • added .putfo
  • 0.2.3 (released 2014-05-10)
    • host code on pypi to keep pip happy
    • move code to bitbucket
    • enhance testing
    • README.rst and LICENSE named properly
    • cleaner error handling
  • 0.2.2
    • additions
      • chdir(self, path) - change the current working directory on the remote
      • getcwd(self) - return the current working directory on the remote
      • listdir(self, path=’.’)return a list of files for the given path

Project details

Release history Release notifications

History Node


This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
pysftp-0.2.8.tar.gz (22.3 kB) Copy SHA256 hash SHA256 Source None May 28, 2014

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page