Skip to main content

Wrappers for SFTP.

Project description


###Features
* 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. If this is something
you don't like, then this is not the package for you. Maybe, someday, I'll make this optional.

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

Most of the time, I only 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.

###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.3.tar.gz (6.0 kB view details)

Uploaded Source

File details

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

File metadata

  • Download URL: cheesefactory-sftp-0.3.tar.gz
  • Upload date:
  • Size: 6.0 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.3.tar.gz
Algorithm Hash digest
SHA256 bcf326d44c92b6e1aa9078594943b3a3ec06aa03610d2e23bef02581c0ea7249
MD5 690dd26f7f5cfea28f282b08b6683224
BLAKE2b-256 88533a49035e26d2874b17b901bda4126ecf2a922c1e4e2d008871e32f1f1a90

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