Skip to main content

Wrapper for Pysftp.

Project description


###Features

* Built around PySFTP.

* Grab NEW files from a remote directory using `get_new_files()`.

Most of the time, I want to get all of the files from the `remote_directory` that I do not already have in my `local_directory`. This method makes me very happy.

* When putting a file in a remote directory, `confirm=True` performs a stat on the remote file.

This can help provide warm fuzzies, but shouldn't be used when the remote server immediately removes the file from the remote directory. This will result in an error, because there will be no file to stat.

* You never have to adjust `pysftp.CnOpts` to `hostkeys=None` again!

I am constantly getting files from remote SFTP servers that I don't already have the key for. Maybe, someday, I'll make this feature optional.

###Connect to the remote SFTP server

```python
from cheesefactory-sftp import SFTP

sftp = SFTP(
host='mysftp.example.com',
port='22',
username='testuser',
password='testpass',
)
```

`hostname` (str): remote server. Default = `127.0.0.1`

`port` (str): SFTP TCP port. Default = `'22'`

`username` (str): SFTP username

`password` (str): SFTP password


###Get a file from the server

```python
sftp.get(
remote_directory='/stuff',
filename='myfile.txt',
local_path='/tmp/'
)
```

`remote_directory` (str): Directory to retrieve file from on remote server. Default = `'/'`

`filename` (str): The name of the file to download.

`local_path` (str): The local directory and filename to copy to--the destination file.

###Put a file on the server

```python
sftp.put(
remote_directory = '/stuff',
filename = 'myfile.txt',
confirm=True
)
```

`remote_directory` (str): Directory on remote server to place the uploaded file.

`filename` (str): The name of the file to upload.

`confirm` (bool): Whether or not to stat the file once uploaded.

###Get new files from remote directory

```python
sftp.get_new_files(
remote_directory = '/remote_stuff',
local_directory = '/local_stuff'
)
```

`remote_directory` (str): Directory on remote server to find new files in.

`local_directory` (str): Directory on local machine to put new files in. The contents of both remote and local directories are compared and only files that are present remotely and not locally are moved.

Keywords: cheesefactory sftp development
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3.6

Project details


Download files

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

Source Distribution

cheesefactory-sftp-0.12.tar.gz (6.6 kB view details)

Uploaded Source

File details

Details for the file cheesefactory-sftp-0.12.tar.gz.

File metadata

  • Download URL: cheesefactory-sftp-0.12.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.6

File hashes

Hashes for cheesefactory-sftp-0.12.tar.gz
Algorithm Hash digest
SHA256 19a7f6c2fff3d9381a3c068d78d9e2a5de795d53a95cf04090494e781f56f9f2
MD5 4b7c6398a65293b8cbdb54d540631acc
BLAKE2b-256 f4c049493a7810d28e50f1636d177c3d6acee9492ce18543759322e58eb04fa6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page