Skip to main content

Copying files save to another machine

Project description

SFTPCopy

sftpcopy allows to copy files to or from a remote server – integrates with gocept.filestore. sftpcopy will take files from the new directory, copy them to the remote server and put them into cur on success. Likewise it will download files from the remote server and put them into the new directory for another application to pick it up.

All together this allows quite stable and asynchronous data transfer.

TODO

  • Documentation

  • Tests!

  • Interfaces would be nice :)

SFTPCopy

Configure an sftpcopy:

>>> import tempfile
>>> import gocept.filestore
>>> import gocept.sftpcopy
>>> store_dir = tempfile.mkdtemp()
>>> filestore = gocept.filestore.FileStore(store_dir)
>>> filestore.prepare()
>>> sftp = gocept.sftpcopy.SFTPCopy(
...     'download', filestore,
...     'localhost', 22, 'testuser', 'dummy-password', 'in')

Connecting will not work because the user does not exist:

>>> sftp.connect()
Traceback (most recent call last):
    ...
AuthenticationException: Authentication failed.

For more tests we’ll need to setup an sftp-server in the test case (via paramiko probably).

Cleanup

>>> import shutil
>>> shutil.rmtree(store_dir)

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

gocept.sftpcopy-0.1.tar.gz (4.8 kB view hashes)

Uploaded Source

Supported by

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