S3操作失败;代码:SignatureDesNotMatch

2024-09-30 12:13:40 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在本地计算机上以docker的身份运行s3:

docker run -p 9000:9000 minio/minio server /data

控制台输出:

Endpoint: http://172.17.0.2:9000  http://127.0.0.1:9000 

Browser Access:
   http://172.17.0.2:9000  http://127.0.0.1:9000

... 
Detected default credentials 'minioadmin:minioadmin', please change the credentials immediately using 'MINIO_ROOT_USER' and 'MINIO_ROOT_PASSWORD'
IAM initialization complete

我可以从web浏览器查看s3(http://127.0.0.1:9000/minio/

我想通过python代码检查bucket是否存在:

    client = Minio(
        endpoint="172.17.0.2:9000",
        access_key="minioadmin",
        secret_key="inioadmin",
        secure=False
    )

    found = client.bucket_exists("aaabbb")
    if not found:
        print("Bucket 'aaabbb' not found")
    else:
        print("Bucket 'aaabbb' already exists")

我得到以下错误:

minio.error.S3Error: S3 operation failed; code: SignatureDoesNotMatch, message: The request signature we calculated does not match the signature you provided. Check your key and signing method., resource: /aaabbb, request_id: 166D184DF48FFDD2, host_id: ad67daae-a8b5-4f5a-a977-c9a022c7c64d, bucket_name: aaabbb

我错过了什么? 如何连接并检查桶是否存在


Tags: andthekeydockerhttps3bucketnot

热门问题