def _BOTO_SINGLEPART(self):
"""
Upload single part (under threshold in node_config)
node_config MULTI_UPLOAD_BARRIER
"""
try:
conn = boto.connect_s3()
except S3ResponseError:
ErrorObject.print_error(
message='Deliverable Fail: s3 Connection Error\n \
Check node_config DELIVERY_ENDPOINT'
)
return False
delv_bucket = conn.get_bucket(
self.auth_dict['edx_s3_endpoint_bucket']
)
upload_key = Key(delv_bucket)
upload_key.key = os.path.basename(os.path.join(
self.node_work_directory,
self.encoded_file
))
headers = {"Content-Disposition": "attachment"}
upload_key.set_contents_from_filename(
os.path.join(
self.node_work_directory,
self.encoded_file
),
headers=headers,
replace=True
)
upload_key.set_acl('public-read')
return True
评论列表
文章目录