本文整理汇总了Python中azure.storage.BlobService.set_blob_properties方法的典型用法代码示例。如果您正苦于以下问题:Python BlobService.set_blob_properties方法的具体用法?Python BlobService.set_blob_properties怎么用?Python BlobService.set_blob_properties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.storage.BlobService
的用法示例。
在下文中一共展示了BlobService.set_blob_properties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle_noargs
# 需要导入模块: from azure.storage import BlobService [as 别名]
# 或者: from azure.storage.BlobService import set_blob_properties [as 别名]
def handle_noargs(self, **options):
try:
blob_service = BlobService(AZURE_ACCOUNT_NAME, AZURE_ACCOUNT_KEY)
mixes = Mix.objects.filter(archive_updated=False)
c = len(mixes)
i = 1
for mix in mixes:
try:
blob_name = "%s.%s" % (mix.uid, mix.filetype)
blob = blob_service.get_blob(AZURE_CONTAINER, blob_name)
if blob:
download_name = smart_str('Deep South Sounds - %s.%s' %
(mix.title, mix.filetype))
blob_service.set_blob_properties(
AZURE_CONTAINER,
blob_name,
x_ms_blob_content_type='application/octet-stream',
x_ms_blob_content_disposition='attachment;filename="%s"' % (download_name)
)
print "Processed: %s (%d of %d)" % (mix.uid, i, c)
i = i + 1
mix.archive_updated = True
mix.save()
else:
print "No blob found for: %s" % mix.uid
except WindowsAzureMissingResourceError:
print "No blob found for: %s" % mix.uid
except Exception, ex:
print "Error processing blob %s: %s" % (mix.uid, ex.message)
except Exception, ex:
print "Fatal error, bailing. %s" % (ex.message)