SoftLayer Object Storage Python Client
Python
Latest commit 670b102 May 29, 2016 @briancline briancline Merge pull request #47 from sergiocarlosmorales/add-datacenters
Added new datacenters and ordered list alphabetically
Permalink
Failed to load latest commit information.
docs Bump version to 0.5.4 Apr 22, 2015
object_storage
tests Fixes PEP8 violations, adds 'pep8' tox test Nov 23, 2014
.gitignore Added compiled docs to the repo. Better documented public methods. Ch… Apr 4, 2012
COPYING Initial Import Feb 14, 2012
README.markdown
setup.cfg
setup.py Get our own name right Nov 23, 2014
tox.ini Fixes PEP8 violations, adds 'pep8' tox test Nov 23, 2014

README.markdown

SoftLayer Object Storage Python Client

Python bindings for SoftLayer Object Storage

Installation

Install via pip:

pip install softlayer-object-storage

Or install from source:

git clone git://github.com/softlayer/softlayer-object-storage-python.git
cd softlayer-object-storage-python
python setup.py install

To build the documentation (requires sphinx):

python setup.py build_sphinx

Basic Usage

import object_storage

sl_storage = object_storage.get_client('YOUR_USERNAME', 'YOUR_API_KEY', datacenter='dal05')

sl_storage.containers()
# []

sl_storage['foo'].create()
# Container(foo)

sl_storage.containers()
# [Container(foo)]

sl_storage['foo'].properties
# {'count': 0, 'object_count': 0, 'name': 'foo', 'size': 0.0}

sl_storage['foo']['bar.txt'].create()
# StorageObject(foo, sample_object.txt)

sl_storage['foo']['bar.txt'].send('Plain-Text Content')
# True

sl_storage['foo']['bar.txt'].read()
# 'Plain-Text Content'

sl_storage['foo'].objects()
# [StorageObject(foo, bar.txt)]

sl_storage['foo']['bar.txt'].delete()
# True

sl_storage['foo'].delete()
# True

Search Usage

sl_storage.search('foo')
# {'count': 2, 'total': 2, 'results': [Container(foo), StorageObject(bar, foo)]}

sl_storage['foo'].search('bar.txt')
# {'count': 1, 'total': 1, 'results': [StorageObject(foo, bar.txt)]}

sl_storage.search('foo', type='container')
# {'count': 1, 'total': 1, 'results': [Container(foo)]}

sl_storage.search('foo*baz')
# {'count': 1, 'total': 1, 'results': [Container(foobarbaz)]}

Development

Here's how to get started:

  • Fork repo on github
  • Clone your new repo to your local machine:

  • git clone git@github.com:username/softlayer-object-storage-python.git 
    

* Configure remote for upstream:

* ```
cd softlayer-object-storage-python
git remote add upstream git://github.com/softlayer/softlayer-object-storage-python.git