gpt4 book ai didi

python - Boto 是否会重试失败的 md5 检查?

转载 作者:太空宇宙 更新时间:2023-11-03 17:54:08 25 4
gpt4 key购买 nike

boto 配置有一个用于上传的 num_retries 参数。

num_retries

The number of times to retry failed requests to an AWS server. If boto receives an error from AWS, it will attempt to recover and retry the request. The default number of retries is 5 but you can change the default with this option.

我的理解是,此参数控制重试 set_content_from_string 等命令的次数。根据文档,如果上传时 md5 校验和不匹配,相同的命令将失败。我的问题是,boto 是否也会在校验和失败时重试,或者 num_retry 是否适用于单独的失败类别?

最佳答案

当 boto 将文件上传到 S3 时,它会在本地计算 MD5 校验和,将该校验和作为 Content-MD5 header 发送到 S3,然后检查 ETag 的值S3 服务根据之前计算的 MD5 校验和返回 header 。如果 ETag header 与 MD5 不匹配,则会引发 S3DataError 异常。此异常是 ClientError 的子类,boto 不会重试客户端错误。

如果我们提供的 Content-MD5 header 与服务计算的 MD5 校验和不匹配,S3 服务也可能返回 BadDigest 错误。这是来自 S3 的 400 响应,也被视为客户端错误,不会重试。

关于python - Boto 是否会重试失败的 md5 检查?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28732751/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com