Skip to content

Commit

Permalink
started work on the object store bindings.
Browse files Browse the repository at this point in the history
  • Loading branch information
AeroNotix committed Jul 3, 2013
1 parent 578df0c commit 9a26664
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions objectstore.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import urllib2

from django.conf import settings
from django_hpcloud.authentication import get_auth_token


def create_directory(container):
'''Creates a directory in the Object Store.
:param container: :class:`str` The name of the directory to make.
'''
container = "%s%s/%s/%s?format=json" % (
settings.OBJECT_STORE_URL, settings.TENANT_ID,
settings.OBJECT_STORE_CONTAINER, container
)
req = urllib2.Request(container)
req.add_header("Content-type", "application/directory")
req.add_header("Content-length", "0")
req.add_header("Accept", "application/json")
req.add_header("X-Auth-Token", get_auth_token())
req.get_method = lambda: "PUT"
response = urllib2.urlopen(req)
return response.getcode()

0 comments on commit 9a26664

Please sign in to comment.