You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@libcloud.apache.org by to...@apache.org on 2016/02/21 16:38:51 UTC
[1/8] libcloud git commit: Include the get_container, get_object,
and upload_object_via_stream methods
Repository: libcloud
Updated Branches:
refs/heads/trunk 358916b4c -> 49bf9cb88
Include the get_container, get_object, and upload_object_via_stream methods
Closes #696
Signed-off-by: Tomaz Muraus <to...@tomaz.me>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/9a0ae93d
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/9a0ae93d
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/9a0ae93d
Branch: refs/heads/trunk
Commit: 9a0ae93da01005771813a7dfa948f962cb5d43f7
Parents: 358916b
Author: Jay Shridharani <js...@gmail.com>
Authored: Tue Feb 9 14:46:45 2016 -0500
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:01:32 2016 +0100
----------------------------------------------------------------------
libcloud/storage/drivers/backblaze_b2.py | 44 +++++++++++++++++++++++--
libcloud/test/storage/test_backblaze_b2.py | 25 ++++++++++++++
2 files changed, 66 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9a0ae93d/libcloud/storage/drivers/backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/backblaze_b2.py b/libcloud/storage/drivers/backblaze_b2.py
index bb37025..5bec5b9 100644
--- a/libcloud/storage/drivers/backblaze_b2.py
+++ b/libcloud/storage/drivers/backblaze_b2.py
@@ -37,6 +37,8 @@ from libcloud.common.types import InvalidCredsError
from libcloud.common.types import LibcloudError
from libcloud.storage.providers import Provider
from libcloud.storage.base import Object, Container, StorageDriver
+from libcloud.storage.types import ContainerDoesNotExistError
+from libcloud.storage.types import ObjectDoesNotExistError
__all__ = [
'BackblazeB2StorageDriver',
@@ -244,6 +246,28 @@ class BackblazeB2StorageDriver(StorageDriver):
objects = self._to_objects(data=resp.object, container=container)
return objects
+ def get_container(self, container_name):
+ containers = self.iterate_containers()
+ container = next((c for c in containers if c.name == container_name),
+ None)
+ if container:
+ return container
+ else:
+ raise ContainerDoesNotExistError(value=None, driver=self,
+ container_name=container_name)
+
+ def get_object(self, container_name, object_name):
+ container = self.get_container(container_name=container_name)
+ objects = self.iterate_container_objects(container)
+
+ obj = next((obj for obj in objects if obj.name == object_name), None)
+
+ if obj is not None:
+ return obj
+ else:
+ raise ObjectDoesNotExistError(value=None, driver=self,
+ object_name=object_name)
+
def create_container(self, container_name, ex_type='allPrivate'):
data = {}
data['bucketName'] = container_name
@@ -292,7 +316,7 @@ class BackblazeB2StorageDriver(StorageDriver):
success_status_code=httplib.OK)
def upload_object(self, file_path, container, object_name, extra=None,
- verify_hash=True, headers=None):
+ verify_hash=True, headers=None, iterator=None):
"""
Upload an object.
@@ -301,8 +325,13 @@ class BackblazeB2StorageDriver(StorageDriver):
# Note: We don't use any of the base driver functions since Backblaze
# API requires you to provide SHA1 has upfront and the base methods
# don't support that
- with open(file_path, 'rb') as fp:
- iterator = iter(fp)
+ object_name = object_name.replace('\\', '/')
+ if iterator is None:
+ with open(file_path, 'rb') as fp:
+ iterator = iter(fp)
+ iterator = read_in_chunks(iterator=iterator)
+ data = exhaust_iterator(iterator=iterator)
+ else:
iterator = read_in_chunks(iterator=iterator)
data = exhaust_iterator(iterator=iterator)
@@ -347,6 +376,15 @@ class BackblazeB2StorageDriver(StorageDriver):
raise LibcloudError('Upload failed. status_code=%s, body=%s' %
(response.status, body), driver=self)
+ def upload_object_via_stream(self, iterator, container, object_name,
+ extra=None, headers=None):
+
+ obj = self.upload_object(file_path=None, container=container,
+ object_name=object_name, extra=None,
+ verify_hash=True, headers=headers,
+ iterator=iterator)
+ return obj
+
def delete_object(self, obj):
data = {}
data['fileName'] = obj.name
http://git-wip-us.apache.org/repos/asf/libcloud/blob/9a0ae93d/libcloud/test/storage/test_backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_backblaze_b2.py b/libcloud/test/storage/test_backblaze_b2.py
index 6a62746..eea9f11 100644
--- a/libcloud/test/storage/test_backblaze_b2.py
+++ b/libcloud/test/storage/test_backblaze_b2.py
@@ -62,6 +62,19 @@ class BackblazeB2StorageDriverTestCase(unittest.TestCase):
self.assertEqual(objects[0].extra['fileId'], 'abcd')
self.assertEqual(objects[0].extra['uploadTimestamp'], 1450545966000)
+ def test_get_container(self):
+ container = self.driver.get_container('test00001')
+ self.assertEqual(container.name, 'test00001')
+ self.assertEqual(container.extra['id'], '481c37de2e1ab3bf5e150710')
+ self.assertEqual(container.extra['bucketType'], 'allPrivate')
+
+ def test_get_object(self):
+ obj = self.driver.get_object('test00001', '2.txt')
+ self.assertEqual(obj.name, '2.txt')
+ self.assertEqual(obj.size, 2)
+ self.assertEqual(obj.extra['fileId'], 'abcd')
+ self.assertEqual(obj.extra['uploadTimestamp'], 1450545966000)
+
def test_create_container(self):
container = self.driver.create_container(container_name='test0005')
self.assertEqual(container.name, 'test0005')
@@ -97,6 +110,18 @@ class BackblazeB2StorageDriverTestCase(unittest.TestCase):
self.assertEqual(obj.size, 24)
self.assertEqual(obj.extra['fileId'], 'abcde')
+ def test_upload_object_via_stream(self):
+ container = self.driver.list_containers()[0]
+ file_path = os.path.abspath(__file__)
+ file = open(file_path, 'rb')
+ iterator = iter(file)
+ obj = self.driver.upload_object_via_stream(iterator=iterator,
+ container=container,
+ object_name='test0007.txt')
+ self.assertEqual(obj.name, 'test0007.txt')
+ self.assertEqual(obj.size, 24)
+ self.assertEqual(obj.extra['fileId'], 'abcde')
+
def test_delete_object(self):
container = self.driver.list_containers()[0]
obj = self.driver.list_container_objects(container=container)[0]
[8/8] libcloud git commit: Use kwargs.
Posted by to...@apache.org.
Use kwargs.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/49bf9cb8
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/49bf9cb8
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/49bf9cb8
Branch: refs/heads/trunk
Commit: 49bf9cb88a4193a4982ee9954c553942b26e7e12
Parents: bfdccee
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sun Feb 21 16:28:50 2016 +0100
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:28:50 2016 +0100
----------------------------------------------------------------------
libcloud/storage/drivers/backblaze_b2.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/49bf9cb8/libcloud/storage/drivers/backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/backblaze_b2.py b/libcloud/storage/drivers/backblaze_b2.py
index 13ec28c..fe2f335 100644
--- a/libcloud/storage/drivers/backblaze_b2.py
+++ b/libcloud/storage/drivers/backblaze_b2.py
@@ -260,7 +260,7 @@ class BackblazeB2StorageDriver(StorageDriver):
def get_object(self, container_name, object_name):
container = self.get_container(container_name=container_name)
- objects = self.iterate_container_objects(container)
+ objects = self.iterate_container_objects(container=container)
obj = next((obj for obj in objects if obj.name == object_name), None)
[4/8] libcloud git commit: Fix Python 2.5 compatibility issue.
Posted by to...@apache.org.
Fix Python 2.5 compatibility issue.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/6dad1a9c
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/6dad1a9c
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/6dad1a9c
Branch: refs/heads/trunk
Commit: 6dad1a9c9e1db63c9fb93a5b7f64e72fadddd43d
Parents: cc8fa74
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sun Feb 21 16:02:24 2016 +0100
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:02:24 2016 +0100
----------------------------------------------------------------------
libcloud/storage/drivers/backblaze_b2.py | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/6dad1a9c/libcloud/storage/drivers/backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/backblaze_b2.py b/libcloud/storage/drivers/backblaze_b2.py
index 1dfa580..7be5266 100644
--- a/libcloud/storage/drivers/backblaze_b2.py
+++ b/libcloud/storage/drivers/backblaze_b2.py
@@ -28,6 +28,7 @@ except ImportError:
from libcloud.utils.py3 import b
from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import urlparse
+from libcloud.utils.py3 import next
from libcloud.utils.files import read_in_chunks
from libcloud.utils.files import exhaust_iterator
from libcloud.utils.escape import sanitize_object_name
[2/8] libcloud git commit: Fix for files with 0xe8 byte in file and
python2
Posted by to...@apache.org.
Fix for files with 0xe8 byte in file and python2
Closes #696
Signed-off-by: Tomaz Muraus <to...@tomaz.me>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/7a185af5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/7a185af5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/7a185af5
Branch: refs/heads/trunk
Commit: 7a185af5f3f393b012e501b6e2aebcfe74e50edf
Parents: 9a0ae93
Author: Jay Shridharani <js...@gmail.com>
Authored: Wed Feb 17 19:14:12 2016 -0500
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:01:38 2016 +0100
----------------------------------------------------------------------
libcloud/storage/drivers/backblaze_b2.py | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/7a185af5/libcloud/storage/drivers/backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/backblaze_b2.py b/libcloud/storage/drivers/backblaze_b2.py
index 5bec5b9..f5303f8 100644
--- a/libcloud/storage/drivers/backblaze_b2.py
+++ b/libcloud/storage/drivers/backblaze_b2.py
@@ -362,6 +362,8 @@ class BackblazeB2StorageDriver(StorageDriver):
upload_host = parsed_url.netloc
request_path = parsed_url.path
+ if isinstance(data, str):
+ data = bytearray(data)
response = self.connection.upload_request(action=request_path,
headers=headers,
upload_host=upload_host,
[3/8] libcloud git commit: Refactor code to better adhere to the API
requirements
Posted by to...@apache.org.
Refactor code to better adhere to the API requirements
Closes #696
Signed-off-by: Tomaz Muraus <to...@tomaz.me>
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/cc8fa74b
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/cc8fa74b
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/cc8fa74b
Branch: refs/heads/trunk
Commit: cc8fa74b8fad30f6ad0a92344bc1c2ae50b1383a
Parents: 7a185af
Author: Jay Shridharani <js...@gmail.com>
Authored: Thu Feb 18 14:11:37 2016 -0500
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:01:44 2016 +0100
----------------------------------------------------------------------
libcloud/storage/drivers/backblaze_b2.py | 121 +++++++++++++++-----------
libcloud/utils/escape.py | 22 +++++
2 files changed, 91 insertions(+), 52 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/cc8fa74b/libcloud/storage/drivers/backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/backblaze_b2.py b/libcloud/storage/drivers/backblaze_b2.py
index f5303f8..1dfa580 100644
--- a/libcloud/storage/drivers/backblaze_b2.py
+++ b/libcloud/storage/drivers/backblaze_b2.py
@@ -30,6 +30,7 @@ from libcloud.utils.py3 import httplib
from libcloud.utils.py3 import urlparse
from libcloud.utils.files import read_in_chunks
from libcloud.utils.files import exhaust_iterator
+from libcloud.utils.escape import sanitize_object_name
from libcloud.common.base import ConnectionUserAndKey
from libcloud.common.base import JsonResponse
@@ -316,7 +317,7 @@ class BackblazeB2StorageDriver(StorageDriver):
success_status_code=httplib.OK)
def upload_object(self, file_path, container, object_name, extra=None,
- verify_hash=True, headers=None, iterator=None):
+ verify_hash=True, headers=None):
"""
Upload an object.
@@ -325,66 +326,33 @@ class BackblazeB2StorageDriver(StorageDriver):
# Note: We don't use any of the base driver functions since Backblaze
# API requires you to provide SHA1 has upfront and the base methods
# don't support that
- object_name = object_name.replace('\\', '/')
- if iterator is None:
- with open(file_path, 'rb') as fp:
- iterator = iter(fp)
- iterator = read_in_chunks(iterator=iterator)
- data = exhaust_iterator(iterator=iterator)
- else:
+
+ with open(file_path, 'rb') as fp:
+ iterator = iter(fp)
iterator = read_in_chunks(iterator=iterator)
data = exhaust_iterator(iterator=iterator)
- extra = extra or {}
- content_type = extra.get('content_type', 'b2/x-auto')
- meta_data = extra.get('meta_data', {})
-
- # Note: Backblaze API doesn't support chunked encoding and we need to
- # provide Content-Length up front (this is one inside _upload_object):/
- headers = headers or {}
- headers['X-Bz-File-Name'] = object_name
- headers['Content-Type'] = content_type
-
- sha1 = hashlib.sha1()
- sha1.update(b(data))
- headers['X-Bz-Content-Sha1'] = sha1.hexdigest()
-
- # Include optional meta-data (up to 10 items)
- for key, value in meta_data:
- # TODO: Encode / escape key
- headers['X-Bz-Info-%s' % (key)] = value
+ obj = self._perform_upload(data, container, object_name,
+ extra, verify_hash, headers)
- upload_data = self.ex_get_upload_data(
- container_id=container.extra['id'])
- upload_token = upload_data['authorizationToken']
- parsed_url = urlparse.urlparse(upload_data['uploadUrl'])
+ return obj
- upload_host = parsed_url.netloc
- request_path = parsed_url.path
+ def upload_object_via_stream(self, iterator, container, object_name,
+ extra=None, headers=None):
+ """
+ Upload an object.
- if isinstance(data, str):
- data = bytearray(data)
- response = self.connection.upload_request(action=request_path,
- headers=headers,
- upload_host=upload_host,
- auth_token=upload_token,
- data=data)
+ Note: Backblaze does not yet support uploading via stream,
+ so this calls upload_object internally requiring the object data
+ to be loaded into memory at once
+ """
- if response.status == httplib.OK:
- obj = self._to_object(item=response.object, container=container)
- return obj
- else:
- body = response.response.read()
- raise LibcloudError('Upload failed. status_code=%s, body=%s' %
- (response.status, body), driver=self)
+ iterator = read_in_chunks(iterator=iterator)
+ data = exhaust_iterator(iterator=iterator)
- def upload_object_via_stream(self, iterator, container, object_name,
- extra=None, headers=None):
+ obj = self._perform_upload(data, container,
+ object_name, extra, headers)
- obj = self.upload_object(file_path=None, container=container,
- object_name=object_name, extra=None,
- verify_hash=True, headers=headers,
- iterator=iterator)
return obj
def delete_object(self, obj):
@@ -500,3 +468,52 @@ class BackblazeB2StorageDriver(StorageDriver):
"""
path = container.name + '/' + obj.name
return path
+
+ def _perform_upload(self, data, container, object_name, extra=None,
+ verify_hash=True, headers=None):
+
+ if isinstance(data, str):
+ data = bytearray(data)
+
+ object_name = sanitize_object_name(object_name)
+
+ extra = extra or {}
+ content_type = extra.get('content_type', 'b2/x-auto')
+ meta_data = extra.get('meta_data', {})
+
+ # Note: Backblaze API doesn't support chunked encoding and we need to
+ # provide Content-Length up front (this is one inside _upload_object):/
+ headers = headers or {}
+ headers['X-Bz-File-Name'] = object_name
+ headers['Content-Type'] = content_type
+
+ sha1 = hashlib.sha1()
+ sha1.update(b(data))
+ headers['X-Bz-Content-Sha1'] = sha1.hexdigest()
+
+ # Include optional meta-data (up to 10 items)
+ for key, value in meta_data:
+ # TODO: Encode / escape key
+ headers['X-Bz-Info-%s' % (key)] = value
+
+ upload_data = self.ex_get_upload_data(
+ container_id=container.extra['id'])
+ upload_token = upload_data['authorizationToken']
+ parsed_url = urlparse.urlparse(upload_data['uploadUrl'])
+
+ upload_host = parsed_url.netloc
+ request_path = parsed_url.path
+
+ response = self.connection.upload_request(action=request_path,
+ headers=headers,
+ upload_host=upload_host,
+ auth_token=upload_token,
+ data=data)
+
+ if response.status == httplib.OK:
+ obj = self._to_object(item=response.object, container=container)
+ return obj
+ else:
+ body = response.response.read()
+ raise LibcloudError('Upload failed. status_code=%s, body=%s' %
+ (response.status, body), driver=self)
http://git-wip-us.apache.org/repos/asf/libcloud/blob/cc8fa74b/libcloud/utils/escape.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/escape.py b/libcloud/utils/escape.py
new file mode 100644
index 0000000..6d139ff
--- /dev/null
+++ b/libcloud/utils/escape.py
@@ -0,0 +1,22 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+__all__ = [
+ 'sanitize_object_name',
+]
+
+
+def sanitize_object_name(object_name):
+ return object_name.replace('\\', '/')
[5/8] libcloud git commit: Fix a argument order bug and use keyword
args.
Posted by to...@apache.org.
Fix a argument order bug and use keyword args.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/3f4e9245
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/3f4e9245
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/3f4e9245
Branch: refs/heads/trunk
Commit: 3f4e92457bf9b40b6626bf9777832557b97e9767
Parents: 6dad1a9
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sun Feb 21 16:03:46 2016 +0100
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:04:50 2016 +0100
----------------------------------------------------------------------
libcloud/storage/drivers/backblaze_b2.py | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/3f4e9245/libcloud/storage/drivers/backblaze_b2.py
----------------------------------------------------------------------
diff --git a/libcloud/storage/drivers/backblaze_b2.py b/libcloud/storage/drivers/backblaze_b2.py
index 7be5266..13ec28c 100644
--- a/libcloud/storage/drivers/backblaze_b2.py
+++ b/libcloud/storage/drivers/backblaze_b2.py
@@ -333,8 +333,11 @@ class BackblazeB2StorageDriver(StorageDriver):
iterator = read_in_chunks(iterator=iterator)
data = exhaust_iterator(iterator=iterator)
- obj = self._perform_upload(data, container, object_name,
- extra, verify_hash, headers)
+ obj = self._perform_upload(data=data, container=container,
+ object_name=object_name,
+ extra=extra,
+ verify_hash=verify_hash,
+ headers=headers)
return obj
@@ -351,8 +354,10 @@ class BackblazeB2StorageDriver(StorageDriver):
iterator = read_in_chunks(iterator=iterator)
data = exhaust_iterator(iterator=iterator)
- obj = self._perform_upload(data, container,
- object_name, extra, headers)
+ obj = self._perform_upload(data=data, container=container,
+ object_name=object_name,
+ extra=extra,
+ headers=headers)
return obj
[7/8] libcloud git commit: Update libcloud.utils.py3.next
implementation so it also supports a default value.
Posted by to...@apache.org.
Update libcloud.utils.py3.next implementation so it also supports a default
value.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/bfdccee5
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/bfdccee5
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/bfdccee5
Branch: refs/heads/trunk
Commit: bfdccee5ae48d4384231587d2cd7a097e394fb33
Parents: 27e0501
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sun Feb 21 16:19:43 2016 +0100
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:19:43 2016 +0100
----------------------------------------------------------------------
libcloud/utils/py3.py | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/bfdccee5/libcloud/utils/py3.py
----------------------------------------------------------------------
diff --git a/libcloud/utils/py3.py b/libcloud/utils/py3.py
index f7a66c0..31e2b23 100644
--- a/libcloud/utils/py3.py
+++ b/libcloud/utils/py3.py
@@ -176,8 +176,15 @@ else:
"""Take an integer and make a 1-character byte string."""
return chr(s)
- def next(i):
- return i.next()
+ _default_value_next = object()
+
+ def next(iterator, default=_default_value_next):
+ try:
+ return iterator.next()
+ except StopIteration:
+ if default is _default_value_next:
+ raise
+ return default
def dictvalues(d):
return d.values()
[6/8] libcloud git commit: Update changelog.
Posted by to...@apache.org.
Update changelog.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/27e0501e
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/27e0501e
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/27e0501e
Branch: refs/heads/trunk
Commit: 27e0501e875b7578cfbec17d9f41ff0867275e1f
Parents: 3f4e924
Author: Tomaz Muraus <to...@tomaz.me>
Authored: Sun Feb 21 16:11:21 2016 +0100
Committer: Tomaz Muraus <to...@tomaz.me>
Committed: Sun Feb 21 16:11:21 2016 +0100
----------------------------------------------------------------------
CHANGES.rst | 8 ++++++++
1 file changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/libcloud/blob/27e0501e/CHANGES.rst
----------------------------------------------------------------------
diff --git a/CHANGES.rst b/CHANGES.rst
index f4c67bf..7723954 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -81,6 +81,14 @@ Storage
(LIBCLOUD-800, GITHUB-689)
[Scott Crunkleton]
+- Implement ``get_container``, ``get_object`` and ``upload_object_via_stream``
+ methods in the Backblaze B2 storage driver.
+
+ Note: Backblaze API doesn't upload streaming uploads so when using
+ ``upload_object_via_stream`` whole file is read and buffered in memory.
+ (GITHUB-696)
+ [Jay jshridha]
+
Backup
~~~~~~