Skip to main content

Unified cloud storage API for storage services.

Project description

https://img.shields.io/pypi/v/cloudstorage.svg https://img.shields.io/pypi/l/cloudstorage.svg https://img.shields.io/pypi/wheel/cloudstorage.svg https://img.shields.io/pypi/pyversions/cloudstorage.svg https://travis-ci.org/scottwernervt/cloudstorage.svg?branch=master https://codeclimate.com/github/scottwernervt/cloudstorage/badges/gpa.svg

Cloud Storage is a Python +3.4 package which creates a unified API for the cloud storage services: Amazon Simple Storage Service (S3), Microsoft Azure Storage, Rackspace Cloud Files, Google Cloud Storage, and the Local File System.

Cloud Storage is inspired by Apache Libcloud. Advantages to Apache Libcloud Storage are:

  • Full Python 3 support.
  • Generate temporary signed URLs for downloading and uploading files.
  • Support for request and response headers like Content-Disposition.
  • Pythonic! Iterate through all blobs in containers and all containers in storage using respective objects.

Usage

>>> from cloudstorage.drivers.amazon import S3Driver
>>> storage = S3Driver(key='<my-aws-access-key-id>', secret='<my-aws-secret-access-key>')

>>> container = storage.create_container('avatars')
>>> container.cdn_url
'https://avatars.s3.amazonaws.com/'

>>> avatar_blob = container.upload_blob('/path/my-avatar.png')
>>> avatar_blob.cdn_url
'https://s3.amazonaws.com/avatars/my-avatar.png'

>>> avatar_blob.generate_download_url(expires=3600)
'https://avatars.s3.amazonaws.com/my-avatar.png?'
'AWSAccessKeyId=<my-aws-access-key-id>'
'&Signature=<generated-signature>'
'&Expires=1491849102'

>>> container.generate_upload_url('user-1-avatar.png', expires=3600)
{
    'url': 'https://avatars.s3.amazonaws.com/',
    'fields': {
        'key': 'user-1-avatar.png',
        'AWSAccessKeyId': '<my-aws-access-key-id>',
        'policy': '<generated-policy>',
        'signature': '<generated-signature>'
    }
}

Installation

To install Cloud Storage:

pip install cloudstorage

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
cloudstorage-0.6-py3-none-any.whl (41.9 kB) Copy SHA256 hash SHA256 Wheel py3 Jul 24, 2018
cloudstorage-0.6.tar.gz (102.1 kB) Copy SHA256 hash SHA256 Source None Jul 24, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page