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 2011/04/09 15:18:26 UTC
svn commit: r1090584 -
/incubator/libcloud/trunk/libcloud/storage/drivers/s3.py
Author: tomaz
Date: Sat Apr 9 13:18:25 2011
New Revision: 1090584
URL: http://svn.apache.org/viewvc?rev=1090584&view=rev
Log:
Add download_object method to the S3 driver.
Modified:
incubator/libcloud/trunk/libcloud/storage/drivers/s3.py
Modified: incubator/libcloud/trunk/libcloud/storage/drivers/s3.py
URL: http://svn.apache.org/viewvc/incubator/libcloud/trunk/libcloud/storage/drivers/s3.py?rev=1090584&r1=1090583&r2=1090584&view=diff
==============================================================================
--- incubator/libcloud/trunk/libcloud/storage/drivers/s3.py (original)
+++ incubator/libcloud/trunk/libcloud/storage/drivers/s3.py Sat Apr 9 13:18:25 2011
@@ -223,6 +223,24 @@ class S3StorageDriver(StorageDriver):
return False
+ def download_object(self, obj, destination_path, overwrite_existing=False,
+ delete_on_failure=True):
+ container_name = self._clean_name(obj.container.name)
+ object_name = self._clean_name(obj.name)
+
+ response = self.connection.request('/%s/%s' % (container_name,
+ object_name),
+ method='GET',
+ raw=True)
+
+ return self._get_object(obj=obj, callback=self._save_object,
+ response=response,
+ callback_kwargs={'obj': obj,
+ 'destination_path': destination_path,
+ 'overwrite_existing': overwrite_existing,
+ 'delete_on_failure': delete_on_failure},
+ success_status_code=httplib.OK)
+
def delete_object(self, obj):
object_name = self._clean_name(name=obj.name)
response = self.connection.request('/%s/%s' % (obj.container.name,