本文整理汇总了Python中azure.storage.blob.BlobService.copy_blob方法的典型用法代码示例。如果您正苦于以下问题:Python BlobService.copy_blob方法的具体用法?Python BlobService.copy_blob怎么用?Python BlobService.copy_blob使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类azure.storage.blob.BlobService
的用法示例。
在下文中一共展示了BlobService.copy_blob方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: copyBlobToBlob
# 需要导入模块: from azure.storage.blob import BlobService [as 别名]
# 或者: from azure.storage.blob.BlobService import copy_blob [as 别名]
def copyBlobToBlob(sourceUrl, sourceKey, destUrl, destKey):
blobservice = BlobService(destUrl, destkey)
srcblobservice = BlobService(SourceUrl, srckey)
today = datetime.datetime.utcnow()
todayPlusMonth = today + datetime.timedelta(1)
todayPlusMonthISO = todayPlusMonth.replace(microsecond=0).isoformat() + 'Z'
srcSasParam = srcblobservice.generate_shared_access_signature(container,
filename, SharedAccessPolicy(AccessPolicy(None, todayPlusMonthISO, "r"), None))
srcUrl = srcblobservice.make_blob_url(container, filename,
sas_token=srcSasParam)
print srcUrl
blobservice.copy_blob(container, filename, srcUrl)
示例2: copyBlobToBlob
# 需要导入模块: from azure.storage.blob import BlobService [as 别名]
# 或者: from azure.storage.blob.BlobService import copy_blob [as 别名]
def copyBlobToBlob(sourceUrl, sourceKey, destUrl, destKey):
sourceParts = split_storage_url(sourceUrl)
destParts = split_storage_url(destUrl)
blobservice = BlobService(destParts[0], destKey)
srcblobservice = BlobService(sourceParts[0], sourceKey)
today = datetime.datetime.utcnow()
todayPlusMonth = today + datetime.timedelta(1)
todayPlusMonthISO = todayPlusMonth.replace(microsecond=0).isoformat() + 'Z'
srcSasParam = srcblobservice.generate_shared_access_signature(sourceParts[2],
sourceParts[3], SharedAccessPolicy(AccessPolicy(None, todayPlusMonthISO, "r"), None))
srcUrl = srcblobservice.make_blob_url(sourceParts[2], sourceParts[3],
sas_token=srcSasParam)
print destParts
blobservice.copy_blob(destParts[2], destParts[3], srcUrl)