Package: cftp
IntroductionThe cftp package provides an ftp-like interface to cloud-based
storage services.  It is basically a wrapper.  It abstracts
the user from the particulars of specific cloud storage services
by exposing a common interface.  Accessing the interface is
simple.  Instantiate a class corresponding to a desired
cloud storage service (eg, Amazon S3).  The class has methods
corresponding to common ftp client commands.The current version includes the four files
noted below.base.py - abstract base class for cloud ftp clientbase_exceptions.py - exceptions raised by base.pys3.py - ftp-like client interface to Amazon’s S3 services3_exceptions.py - exceptions raised by s3.py__main__.py - shim for s3ftp command line script (console script)Over time, this package may be extended to include an
ftp-like client interface to the DropBox storage services.  That
functionality would be implemented as a sub-class of base.py,
just as s3.py is a sub-class.  The same is true for other
cloud-based storage services that offer an API.InstallationInstall usingpiporeasy_install.  The cftp package does
require Amazon’s boto3 package, which exposes an API for controlling
AWS objects using python.  The boto3 package will be automatically
installed (via pip or easy_install), since it is listed as a
dependency in this package.This package also includes a tool calleds3ftpthat provides
command line, ftp-like access to the Amazon S3 service.ConfigurationBefore using this package, you will need to setup AWS authentication
credentials as required by boto3.  See the following URL:https://boto3.readthedocs.org/en/latest/guide/quickstart.html#configurationThis distribution also includes a file called,s3ftp.json.  It
contains default parameters used when reading or writing objects in
an S3 bucket.  For example, it can be used to specify if/how
objects are encrypted or to add metadata to objects.  Edit this
file to reflect desired default parameters.  Then copy it to your
home directory and rename to.s3ftp.json.  The parameters include
those allowed in theextraArgsargument to the S3Transfer functionsdownload_fileandupload_file.TheS3FtpClientconstructor looks for a.s3ftp.jsonfile
first in the current working directory and then in the user’s
home directory.  If it finds this file, then it loads default
parameters for S3 objects from there.  The constructor may also
be called with an argument that specifies default object parameters.
If so, these are merged with defaults read from the.s3ftp.jsonfile.  If a particular default is specified in both the.s3ftp.jsonfile and the constructor argument, then the
latter takes precedence.Note that when running s3ftp interactively, it is not yet
possible to change these parameters without quitting, editing.s3ftp.jsonand restarting.  However, the S3FtpClient class
does have methods to get and set the default  parameters.Handling of incorrectly specified defaults is rudimentary
right now.Using thes3ftpCommand Line UtilityThe following illustrates using the interactives3ftpcommand line
utility.  It assumes the existence of an Amazon S3 bucket, in this
this case a notional bucket namedcom.s3ftp.test.The following connects to a bucket, lists its contents,
changes the remote working directory (in the bucket),
changes the local working directory, creates a directory
in the bucket, uploads a file to it, multiple gets several files,
deletes a file from the bucket, closes the bucket, opens a
new bucket, lists its contents, and quits.  Below does not
show s3ftp output.s3ftp com.s3ftp.testlscd dir1/dir2lcd ~mkdir dir3put file1mget f*.txtdelete file2closeopen com.s3ftp2.test2lsclosequitNotesThe Amazon S3 client above does not support creation or deletion
of S3 buckets.  It assumes the bucket already exists.  This is
consistent with behavior of a traditional ftp client in that it
is accessing existing storage (on an ftp server).This software has been tested on Linux but not Windows or
Mac OS platforms.The S3FtpClient object (and associated s3ftp utility) do not
provide the ability to examine S3 object parameters, such as
metadata and content-type.  This could be added in the future
as an auxiliary (non-ftp) command.Changes in this ReleaseRearchitected the internal design of the BaseFtpClient and
the S3FtpClient.  Moved more implementation-independent functionality
into the BaseFTPClient.  Created abstract methods in the base
client that can be overridden to implement functionality
specific to Amazon S3 or other cloud providers.Made some internal bug fixes to handling of the extraArgs
parameters in the S3FtpClient.