- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用azure-sdk-for-python BlobClient
start_copy_from_url
将远程文件复制到本地存储。
但是,文件最终总是作为 AppendBlob 而不是 BlockBlob。我不明白如何强制目标 BlockType 为 BlockBlob。
connection_string = "connection string to my dest blob storage account"
container_name = "myContainerName"
dest_file_name = "myDestFile.csv"
remote_blob_url = "http://path/to/remote/blobfile.csv"
client = BlobServiceClient.from_connection_string(connection_string)
dest_blob = client.get_blob_client(container_name, dest_file_name)
dest_blob.start_copy_from_url(remote_blob_url)
最佳答案
一旦创建 blob 类型,就无法更改它。请参阅 Copy Blob From URL REST API ,没有 blob-types
header 。
您可以引用我的代码从附加 blob 创建 block blob:
from azure.storage.blob import BlobPermissions
from datetime import datetime, timedelta
from azure.storage.blob import BlockBlobService
import requests
from io import BytesIO
account_name = "***"
account_key = "***"
container_name = "test"
blob_name = "test2.csv"
block_blob_service = BlockBlobService(account_name, account_key)
sas_token = block_blob_service.generate_blob_shared_access_signature(container_name, blob_name,
permission=BlobPermissions.READ,
expiry=datetime.utcnow() + timedelta(hours=1))
blob_url_with_sas = block_blob_service.make_blob_url(container_name, blob_name, sas_token=sas_token)
r = requests.get(blob_url_with_sas, stream=True)
block_blob_service.create_blob_from_stream("test", "jay.block", stream=BytesIO(r.content))
关于python - 从远程 URL 将 Azure Blob 复制为 BlockBlob,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58925500/
当我调用“await blockBlob.UploadFromStreamAsync(stream);”时,我发现该流的内容长度为某个值(500+字节)。 但是一旦调用,我发现 blockblob 中
我目前正在尝试 Azure TableStorage,并有一个关于 BlockBlob 的问题:我可以使用 REST 按 BlockID 下载特定的 BlobBlock(以及如何下载)吗? 我认为它可
我目前正在尝试 Azure TableStorage,并有一个关于 BlockBlob 的问题:我可以使用 REST 按 BlockID 下载特定的 BlobBlock(以及如何下载)吗? 我认为它可
我正在尝试从 Azure BlockBlob 获取“内容类型”。好像不行。 如您所见,该文件的“内容类型”是“image/jpeg”。 var cloudConn = Syst
我正在使用 C# 中的 Microsoft.WindowsAzure.Storage.* 库。 这就是我将内容上传到存储的方式: // Store in storage CloudStorageAcc
我无法确定 BlockBlob 是否根本不存在或包含未提交的 block 。 请检查以下代码: private CloudBlobContainer _blobContainer; private a
我一直在尝试使用 Insomnia 将元数据更新到我的 BlockBlob。我已设法使用 header 清除元数据(参数 json 为空): enter image description here
我想将 Blob 类型从 Append Blob 更改为 BlockBlob。根据How to convert from Azure Append Blob to Azure Block Blob这不
我想使用“经典”日志方法将文本行写入文本文件。我不想将其保存在本地,而是想将数据写入 blockblob。这是代码: CloudStorageAccount storageAccount = Clou
根据标题,我有一个程序,我尝试使用 PutBlock 方法添加到现有的 BlobkBlob: private static void UploadNewText(string text)
所有,我试图在网页中上传一个更大的文件(700MB),其中包含 Form 中的 File html 元素。我想在服务器端可以获取流并将其上传到Azure存储中。这是服务器端的一些代码片段。 publi
所有,我试图在网页中上传一个更大的文件(700MB),其中包含 Form 中的 File html 元素。我想在服务器端可以获取流并将其上传到Azure存储中。这是服务器端的一些代码片段。 publi
我正在使用azure-sdk-for-python BlobClient start_copy_from_url 将远程文件复制到本地存储。 但是,文件最终总是作为 AppendBlob 而不是 Bl
我最近遇到了一个错误,或者至少是通过 .NET 客户端使用的 BlockBlob 的一个非常奇怪的行为。 基本上,写入和刷新的特定组合会损坏文件,如果您在写入后读回它,则响应流包含垃圾(更准确地说,它
我还没有找到一个有效的例子。我的以下示例告诉我 createBlockBlob 方法未定义。 注意:我也尝试过 createBlockBlobFromLocalFile 并传入文件名,但仍然没有成功。
我还没有找到一个有效的例子。我的以下示例告诉我 createBlockBlob 方法未定义。 注意:我也尝试过 createBlockBlobFromLocalFile 并传入文件名,但仍然没有成功。
我想使用 Azure REST API 在 Azure 上的 Blob 上设置一些自定义元数据属性。文件上传工作正常(也通过 REST API 完成)。为了设置我的自定义元数据,我遵循 these i
在处理 Azure Blob 存储时,每个 Blob 数据都有元数据,但没有办法向每个 block 添加元数据。 在我们的例子中,有一些数据我们希望将其与实际 block 内容分开,但在创建时仍附加到
我是一名优秀的程序员,十分优秀!