https://docs.aws.amazon.com/AmazonS3/latest/API/API_Object.html
https://repost.aws/zh-Hans/knowledge-center/data-integrity-s3
https://evvail.com/2020/07/24/1047.html
https://documenter.getpostman.com/view/1747463/SzzheJEs#intro
AWS S3 对
ETag
的官方描述
The entity tag is a hash of the object. The ETag reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described below:
Objects created by the PUT Object, POST Object, or Copy operation, or through the AWS Management Console, and are encrypted by SSE-S3 or plaintext, have ETags that are an MD5 digest of their object data.
Objects created by the PUT Object, POST Object, or Copy operation, or through the AWS Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.
If an object is created by either the Multipart Upload or Part Copy operation, the ETag is not an MD5 digest, regardless of the method of encryption. If an object is larger than 16 MB, the AWS Management Console will upload or copy that object as a Multipart Upload, and therefore the ETag will not be an MD5 digest.
mc client 获取 ETag 属性
python sdk 获取 ETag 属性
https://min.io/docs/minio/linux/developers/python/minio-py.html
https://min.io/docs/minio/linux/developers/python/API.html
https://github.com/minio/minio-py/tree/master/examples
https://crashlaker.github.io/2022/05/13/minio_python.html
安装模块
pip3 install minio
程序
from minio import Minio
client = Minio(
"obs.xxxxxx.com",
access_key="xxxxxx",
secret_key="xxxxxx",
)
# Get object information.
result = client.stat_object("test", "yourefilename.pdf")
print(type(result))
print(result.metadata)
etag = result.metadata.get('ETag')
print("ETag is :" ,etag)
[root@VM-201-31-centos ~]# python get_minio_etag.py
<class 'minio.datatypes.Object'>
HTTPHeaderDict({'Date': 'Wed, 20 Mar 2024 02:40:42 GMT', 'Content-Type': 'application/pdf', 'Content-Length': '174116', 'Connection': 'keep-alive', 'Accept-Ranges': 'bytes', 'ETag': '"a73e211539ea2a046ed5cae95e2bd771"', 'Last-Modified': 'Tue, 19 Mar 2024 08:04:42 GMT', 'Server': 'MinIO', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Vary': 'Origin, Accept-Encoding', 'X-Amz-Bucket-Region': 'rhsh', 'X-Amz-Id-2': '52c23b8a9155ca750842f2c78f0b9b3c48d424c22da32c818bcabce3b3114cae', 'X-Amz-Request-Id': '17BE58B4F4F468AA', 'X-Content-Type-Options': 'nosniff', 'X-Xss-Protection': '1; mode=block'})
------------------------------- etag ------------------------------
ETag is : "a73e211539ea2a046ed5cae95e2bd771"