我有一个 python 脚本来生成一个预签名的 url 并验证它。该脚本适用于我的笔记本电脑,但不适用于我同事的笔记本电脑。错误消息说要检查 AWS 秘密访问密钥和签名方法。AWS 访问/密钥是有效的,可用于访问其他 AWS API。如何进一步排除故障?
import requests
import boto3
url = boto3.client('sts').generate_presigned_url(
'get_caller_identity',
Params={},
ExpiresIn=300)
r = requests.post(url)
print r.status_code
print r.text
错误响应:-
<ErrorResponse xmlns="https://sts.amazonaws.com/doc/2011-06-15/">
<Error>
<Type>Sender</Type>
<Code>SignatureDoesNotMatch</Code>
<Message>The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.</Message>
</Error>
</ErrorResponse>