Giter Site home page Giter Site logo

chadmasso / bucketstore Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jpetrucciani/bucketstore

0.0 2.0 0.0 37 KB

A simple library for interacting with Amazon S3.

Home Page: https://pypi.org/project/bucketstore/

License: MIT License

Python 100.00%

bucketstore's Introduction

BucketStore: A simple Amazon S3 Client, for Python.

BucketStore is a very simple Amazon S3 client, written in Python. It aims to be much more straight-forward to use than boto3, and specializes only in Amazon S3, ignoring the rest of the AWS ecosystem.

Features

  • Treats S3 Buckets as Key/Value stores.
  • Automatic support for AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables.
  • Easily make keys (or entire buckets) publically accessable.
  • Easily get the public URL for a given key.
  • Generates temporary URLs for a given key.

Usage

Get (or create) a bucket, easily:

import bucketstore

# Create the bucket if it doesn't exist.
bucket = bucketstore.get('bucketstore-playground', create=True)

Treat the bucket like a key/value store:

>>> bucket
<S3Bucket name='bucketstore-playground'>

>>> bucket['foo'] = 'bar'
>>> bucket['foo']
bar

>>> bucket.set('foo2', 'bar2')
>>> bucket.get('foo2')
bar2

>>> bucket.list()
[u'foo', u'foo2']

>>> bucket.all()
[<S3Key name=u'foo' bucket='bucketstore-playground'>, <S3Key name=u'foo2' bucket='bucketstore-playground'>]

Interact with S3 keys:

>>> bucket.key('foo')
<S3Key bucket='bucketstore-playground' name=u'foo'>

>>> foo = _
>>> foo.set('new value')

# Generate a temporary share URL.
>>> foo.temp_url(duration=1200)
u'https://bucketstore-playground.s3.amazonaws.com/foo?AWSAccessKeyId=AKIAI2RVFNXIW7WS66QQ&Expires=1485493909&Signature=L3gD9avwQZQO1i11dIJXUiZ7Nx8%3D'

# Make key publically accessable.
>>> foo.make_public()
>>> foo.url
'https://s3.amazonaws.com/bucketstore-playground/foo'

# Get / set metadata for key.
>>> foo.meta = {'foo': 'bar'}
>>> foo.meta
{'foo': 'bar}

# Rename key to 'foo3'.
>>> foo.rename('foo3')

# Delete the key.
>>> foo.delete()

Other methods include bucketstore.login(access_key_id, secret_access_key), bucketstore.list(), and bucketstore.get(bucket_name, create=False).

Installation

$ pip install bucketstore

โœจ๐Ÿฐโœจ

bucketstore's People

Contributors

kennethreitz avatar chadmasso avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.