Skip to main content

Python wrapper for an AWS S3 backed key-value store.

Project description

s3-kvs

A python wrapper for an S3 backed key-value store.

Usage

Import and create a client instance, setting a domain and optionally a namespace:

from s3_kvs import ReadOnlyClient

client = ReadOnlyClient(domain=’kvs.example.com’)

OR

client = ReadOnlyClient(domain=’kvs.example.com’, namespace=’test’)

Then use then use the getitem notation to retrieve values from the key store:

client[‘foo’]

> ‘bar’

Or, use the get method to provide a default if no matching value is found:

client.get(‘foo’, ‘oops’)

> ‘oops’

By default returned values are text. You can also treat them as json and automatically parse them:

text_client = ReadOnlyClient(domain=’kvs.example.com’)

client[‘foo’]

> ‘{“bar”: “baz”}’ # a json string

json_client = ReadOnlyClient(domain=’kvs.example.com’, value_format=’json’)

client[‘foo’]

> {‘bar’: ‘baz’} # a python dict

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

s3-kvs-0.1.3.tar.gz (2.7 kB view hashes)

Uploaded Source

Built Distribution

s3_kvs-0.1.3-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page