【发布时间】:2021-01-05 23:39:58
【问题描述】:
我希望通过 Cognito 身份池获取临时 AWS 凭证,以通过 API Gateway 将数据发送到 Kinesis 流。 需要注意的一点是,我尝试在没有 AWS 开发工具包的情况下执行此操作,因为最终将使用它编写的语言没有兼容的开发工具包。我正在测试 Python 中的解决方案,并且似乎遗漏了一些东西,因为我不断收到 400 错误。关于我在这里做错了什么的任何想法?
import requests
url = 'https://cognito-identity.us-east-1.amazonaws.com' #cognito regional endpoint
headers = {
'X-AMZ-TARGET': 'com.amazonaws.cognito.identity.model.AWSCognitoIdentityService.GetCredentialsForIdentity',
'X-AMZ-DATE': '20151020T232759Z'
}
body = {
'IdentityId': 'us-east-1:123456789' #identity id
}
response = requests.post(url = url, data = body, headers = headers)
print(response)
【问题讨论】:
标签: python amazon-web-services aws-api-gateway amazon-cognito