gpt4 book ai didi

Python S3 Boto 生成带有 SignatureDoesNotMatch 错误的 URL

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

        import boto
from boto.s3.connection import S3Connection
import requests

conn = S3Connection('-----------------', '-------------------')
snapsbucket = conn.get_bucket('snaps-snaps')

for key in snapsbucket.list('a'):
print key.name
print key.generate_url(expires_in=90)

这将输出文件名和 URL 的列表。当我关注某个 url 时,我会得到以下 xml:

        <Error>
<Code>SignatureDoesNotMatch</Code>
<Message>
The request signature we calculated does not match the signature you provided. Check your key and signing method.
</Message>
<StringToSignBytes>
47 45 54 0a 0a 0a 31 33 39 37 30 38 34 30 35 37 0a 2f 73 6e 61 70 73 2d 73 6e 61 70 73 2f 61 73 73 65 6c 69 6e 70 61 75 6c 5f 61 73 73 65 6c 69 6e 70 61 75 6c 7e 31 33 39 36 39 38 36 38 37 39 34 36 35 2e 6d 70 34
</StringToSignBytes>
<RequestId>2C2A6E1194BAAD85</RequestId>
<HostId>
ReNCy1k3OqBd2xyfA5tyixhD7MXnNACqBspsl61IAN7GSF1haK03cv4r6x6WHle/
</HostId>
<SignatureProvided>IlRoL9AZJZQYL4/L0wySexMBjnw=</SignatureProvided>
<StringToSign>
GET 1397084057 /snaps-snaps/asselinpaul_asselinpaul~1396986879465.mp4
</StringToSign>
<AWSAccessKeyId>--------------</AWSAccessKeyId>
</Error>

卡在这里,非常感谢任何帮助。

最佳答案

结果我的文件名包含波浪号 (~)。

这会弄乱 URL,从而导致错误。

关于Python S3 Boto 生成带有 SignatureDoesNotMatch 错误的 URL,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22975514/

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