gocept.sftpcopy


Namegocept.sftpcopy JSON
Version 0.6.0 PyPI version JSON
download
home_pagehttps://bitbucket.org/gocept/gocept.sftpcopy
SummaryUpload/download files via SFTP to a maildir structure
upload_time2016-11-02 15:43:48
maintainer
docs_urlNone
authorChristian Zagrodnick
requires_python
licenseZPL 2.1
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ========
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.

Usage
=====

You can either give the name of a configuration file on the commandline, or
pass the configuration values as a dict directly to the entrypoint (useful for
buildout integration). The configuration file has the following format::

    [general]
    mode = upload # or download
    logfile = /path/to/logfile # defaults to stdout if not given
    buffer_size = 65536
    skip_files =
        name_of_file_to_skip_1
        name_of_file_to_skip_2

    [local]
    path = /path/on/local/machine

    [remote]
    path = /path/on/remote/machine
    hostname = remote.host
    port = 22
    username = user
    password = secret

The configdict uses the following keys instead:

- logfile
- buffer_size (default: 65536, i.e. 64 KiB)
- keepalive_interval (default: 5 seconds)
- local_path
- remote_path
- hostname
- port
- username
- password
- key_filename
- skip_files

key_filename takes precedence over password. If key_filename ends with ``dsa``,
it's assumed to be a DSA key, else an RSA key. Note that the key file must not
be password protected.

`skip_files` is a list of filenames (local or remote), which are skipped during
upload or download.

Files are copied in chunks of buffer_size to avoid loading big files into
memory at once.

You can also use sftpcopy as a python object like this::

    import gocept.sftpcopy
    sftp = gocept.sftpcopy.SFTPCopy(
        '/path/on/local/machine',
        'remote.host', 22, 'user', 'secret', '/path/on/remote/machine',
        skip_files=['my_file_to_ignore'])
    sftp.connect()
    sftp.uploadNewFiles() # or sftp.downloadNewFiles()


AMQP integration
================

If you require the `amqp` extra, gocept.sftpcopy offers a `gocept.amqprun`_
queue handler that uploads the message body as a file via SFTP (it respects the
``X-Filename`` header or generates a filename based on routing key and a
timestamp). Here's an example ZCML snippet::

    <configure xmlns="http://namespaces.zope.org/zope"
               xmlns:amqp="http://namespaces.gocept.com/amqp">

      <include package="gocept.amqprun" />
      <include package="gocept.sftpcopy" file="meta.zcml" />

      <amqp:sftpupload
        routing_key="test.data"
        queue_name="test.queue"
        hostname="remote.host"
        port="22"
        username="user"
        password="secret" [ALTERNATIVELY] key_filename="/path/to/private_key"
        remote_path="/path/on/remote/machine"
        arguments="
        x-ha-policy = all
        "
        />

    </configure>


.. _`gocept.amqprun`: http://pypi.python.org/pypi/gocept.amqprun


Changelog
=========

0.6.0 (2016-11-02)
==================

- Pinning version numbers of dependencies for tests.

- Migrate to py.test as testrunner.

- Add new `skip_files` parameter to skip upload or download of files.


0.5.1 (2015-04-15)
==================

- Update `bootstrap.py` to version from ``zc.buildout 2.3.0``.

- Move repository to `bitbucket.org`.


0.5.0 (2014-11-26)
==================

- Set up keep-alive checking.


0.4.1 (2014-03-07)
==================

- Fixed brown-bag release.


0.4.0 (2014-03-07)
==================

- Copy files in chunks instead of loading each complete file into memory.
  There is a new config option ``buffer_size`` which defaults to 64 kB.


0.3.0 (2014-02-20)
==================

- Support key-based authentication.

- Check that the size of the transmitted file after up/download matches what
  was transferred.


0.2.2 (2012-04-04)
==================

- Update to gocept.amqprun-0.8.


0.2.1 (2012-03-29)
==================

- Make amqp server configurable for tests.
- Clean up garbage connections left by tests (#10634).


0.2 (2012-02-22)
================

- Add ``gocept.amqprun`` integration.


0.1.4 (2009-11-16)
==================

- Log errors that occur while connecting


0.1.3 (2008-02-27)
==================

- Added ``configdict`` argument to main function for easier buildout
  integration.


0.1.2 (2008-02-18)
==================

- Fixed bug in connection logging.
- Remember filestore so we can actually upload/download.
- Did some testing predefined user.


0.1.1 (2007-11-13)
==================

- Fixed brown back release 0.1 which was not usable at all since there were
  various files missing in the archive.
            

Raw data

            {
    "_id": null,
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "cheesecake_code_kwalitee_id": null,
    "keywords": "",
    "upload_time": "2016-11-02 15:43:48",
    "author": "Christian Zagrodnick",
    "home_page": "https://bitbucket.org/gocept/gocept.sftpcopy",
    "download_url": "https://pypi.python.org/packages/9a/a5/7df5c978da6e808a942e4dda7e1f075a4ce9454e03e98d568a7380efe947/gocept.sftpcopy-0.6.0.tar.gz",
    "platform": "",
    "version": "0.6.0",
    "cheesecake_documentation_id": null,
    "description": "========\nSFTPCopy\n========\n\nsftpcopy allows to copy files to or from a remote server -- integrates with\ngocept.filestore. sftpcopy will take files from the ``new`` directory, copy\nthem to the remote server and put them into ``cur`` on success. Likewise it will\ndownload files from the remote server and put them into the ``new``\ndirectory for another application to pick it up.\n\nUsage\n=====\n\nYou can either give the name of a configuration file on the commandline, or\npass the configuration values as a dict directly to the entrypoint (useful for\nbuildout integration). The configuration file has the following format::\n\n    [general]\n    mode = upload # or download\n    logfile = /path/to/logfile # defaults to stdout if not given\n    buffer_size = 65536\n    skip_files =\n        name_of_file_to_skip_1\n        name_of_file_to_skip_2\n\n    [local]\n    path = /path/on/local/machine\n\n    [remote]\n    path = /path/on/remote/machine\n    hostname = remote.host\n    port = 22\n    username = user\n    password = secret\n\nThe configdict uses the following keys instead:\n\n- logfile\n- buffer_size (default: 65536, i.e. 64 KiB)\n- keepalive_interval (default: 5 seconds)\n- local_path\n- remote_path\n- hostname\n- port\n- username\n- password\n- key_filename\n- skip_files\n\nkey_filename takes precedence over password. If key_filename ends with ``dsa``,\nit's assumed to be a DSA key, else an RSA key. Note that the key file must not\nbe password protected.\n\n`skip_files` is a list of filenames (local or remote), which are skipped during\nupload or download.\n\nFiles are copied in chunks of buffer_size to avoid loading big files into\nmemory at once.\n\nYou can also use sftpcopy as a python object like this::\n\n    import gocept.sftpcopy\n    sftp = gocept.sftpcopy.SFTPCopy(\n        '/path/on/local/machine',\n        'remote.host', 22, 'user', 'secret', '/path/on/remote/machine',\n        skip_files=['my_file_to_ignore'])\n    sftp.connect()\n    sftp.uploadNewFiles() # or sftp.downloadNewFiles()\n\n\nAMQP integration\n================\n\nIf you require the `amqp` extra, gocept.sftpcopy offers a `gocept.amqprun`_\nqueue handler that uploads the message body as a file via SFTP (it respects the\n``X-Filename`` header or generates a filename based on routing key and a\ntimestamp). Here's an example ZCML snippet::\n\n    <configure xmlns=\"http://namespaces.zope.org/zope\"\n               xmlns:amqp=\"http://namespaces.gocept.com/amqp\">\n\n      <include package=\"gocept.amqprun\" />\n      <include package=\"gocept.sftpcopy\" file=\"meta.zcml\" />\n\n      <amqp:sftpupload\n        routing_key=\"test.data\"\n        queue_name=\"test.queue\"\n        hostname=\"remote.host\"\n        port=\"22\"\n        username=\"user\"\n        password=\"secret\" [ALTERNATIVELY] key_filename=\"/path/to/private_key\"\n        remote_path=\"/path/on/remote/machine\"\n        arguments=\"\n        x-ha-policy = all\n        \"\n        />\n\n    </configure>\n\n\n.. _`gocept.amqprun`: http://pypi.python.org/pypi/gocept.amqprun\n\n\nChangelog\n=========\n\n0.6.0 (2016-11-02)\n==================\n\n- Pinning version numbers of dependencies for tests.\n\n- Migrate to py.test as testrunner.\n\n- Add new `skip_files` parameter to skip upload or download of files.\n\n\n0.5.1 (2015-04-15)\n==================\n\n- Update `bootstrap.py` to version from ``zc.buildout 2.3.0``.\n\n- Move repository to `bitbucket.org`.\n\n\n0.5.0 (2014-11-26)\n==================\n\n- Set up keep-alive checking.\n\n\n0.4.1 (2014-03-07)\n==================\n\n- Fixed brown-bag release.\n\n\n0.4.0 (2014-03-07)\n==================\n\n- Copy files in chunks instead of loading each complete file into memory.\n  There is a new config option ``buffer_size`` which defaults to 64 kB.\n\n\n0.3.0 (2014-02-20)\n==================\n\n- Support key-based authentication.\n\n- Check that the size of the transmitted file after up/download matches what\n  was transferred.\n\n\n0.2.2 (2012-04-04)\n==================\n\n- Update to gocept.amqprun-0.8.\n\n\n0.2.1 (2012-03-29)\n==================\n\n- Make amqp server configurable for tests.\n- Clean up garbage connections left by tests (#10634).\n\n\n0.2 (2012-02-22)\n================\n\n- Add ``gocept.amqprun`` integration.\n\n\n0.1.4 (2009-11-16)\n==================\n\n- Log errors that occur while connecting\n\n\n0.1.3 (2008-02-27)\n==================\n\n- Added ``configdict`` argument to main function for easier buildout\n  integration.\n\n\n0.1.2 (2008-02-18)\n==================\n\n- Fixed bug in connection logging.\n- Remember filestore so we can actually upload/download.\n- Did some testing predefined user.\n\n\n0.1.1 (2007-11-13)\n==================\n\n- Fixed brown back release 0.1 which was not usable at all since there were\n  various files missing in the archive.",
    "lcname": "gocept.sftpcopy",
    "name": "gocept.sftpcopy",
    "github": false,
    "bugtrack_url": null,
    "license": "ZPL 2.1",
    "summary": "Upload/download files via SFTP to a maildir structure",
    "split_keywords": [],
    "author_email": "mail@gocept.com",
    "urls": [
        {
            "has_sig": false,
            "upload_time": "2016-11-02T15:43:48",
            "comment_text": "",
            "python_version": "source",
            "url": "https://pypi.python.org/packages/9a/a5/7df5c978da6e808a942e4dda7e1f075a4ce9454e03e98d568a7380efe947/gocept.sftpcopy-0.6.0.tar.gz",
            "md5_digest": "8ddf5480d09e906fbb8e618aed99054a",
            "downloads": 0,
            "filename": "gocept.sftpcopy-0.6.0.tar.gz",
            "packagetype": "sdist",
            "path": "9a/a5/7df5c978da6e808a942e4dda7e1f075a4ce9454e03e98d568a7380efe947/gocept.sftpcopy-0.6.0.tar.gz",
            "size": 14798
        }
    ],
    "cheesecake_installability_id": null
}
        
Elapsed time: 0.02288s