A simple library for interacting with Amazon S3.
Project description
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()
# Create a key with metadata at the same time.
>>> foo = bucket.key('foo.html')
>>> foo.set('<h1>bar</h1>', {'content_type': 'text/html'})
Other methods include bucketstore.login(access_key_id, secret_access_key), bucketstore.list(), and bucketstore.get(bucket_name, create=False).
Installation
$ pip install bucketstore
✨🍰✨
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
Built Distribution
File details
Details for the file bucketstore-0.1.3.tar.gz
.
File metadata
- Download URL: bucketstore-0.1.3.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fc2721ca91b3d6cd16b9214c6d3be7bd97b12201e936a9475ba0320fdd72f00 |
|
MD5 | 8e70fbb388bfe931389b60e80110bd7b |
|
BLAKE2b-256 | aefbda126368bcc1bf8a74d3abf73da5f6b720d6bef1e0d1b1409d24bd61e90b |
File details
Details for the file bucketstore-0.1.3-py2-none-any.whl
.
File metadata
- Download URL: bucketstore-0.1.3-py2-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | b1fd20adb3c1e09b64872fc7571d955b49b8a5868118c0ec0789d0935114b490 |
|
MD5 | 0a675d543c4fcd7ddf5697407dde01ed |
|
BLAKE2b-256 | 4e1f5f0bb1595b5319ff2cac11beeb80c49a29ca01c642398d4ec4c5eb1687d7 |