Skip to main content

Wrappers for SFTP.

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.9.tar.gz (6.5 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: cheesefactory-sftp-0.9.tar.gz
  • Upload date:
  • Size: 6.5 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.9.tar.gz
Algorithm Hash digest
SHA256 262f7524f7d656ac0d7d9410f0b0d0ff8f5f1e2ac33fb154b9c801b0571bdcef
MD5 f66506c0b2cfb83e846d4b0c829063e4
BLAKE2b-256 5ddfd082eb7d7098748ba4fb4a72ba1941bc858f65eda9e0996fcbd6b7306778

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