我试图用Python调用Amazon的SimpleDB服务。例如,我使用最简单的请求,ListDomains
。但是,不管我怎么尝试,得到的响应总是“我们计算的请求签名与您提供的签名不匹配。”
这是我要签名的字符串(根据documentation here):
GET
https://sdb.amazonaws.com/
/
AWSAccessKeyId=<redacted>&Action=ListDomains&SignatureMethod=HmacSHA1&SignatureVersion=2&Timestamp=2011-04-19T18%3A50%3A43&Version=2009-04-15
我用以下代码签名:
^{pr2}$我尝试过HmacSHA256和HmacSHA1。似乎什么都不管用。我做错什么了?在
我不会重新发明轮子——有几个pythonsimpledb库,比如
如果没有别的,他们的签名代码应该澄清你的错误是什么,但是说真的,使用一个现有的维护的API,它会让你的生活更轻松。在
一个关键问题是必须正确地对所有HTTP参数值进行URL编码。在
以下文档已从SimpleDB文档中消失,但可以在SQS文档中找到,并且仍然与SimpleDB非常相关:
您会注意到,在Roger链接的
python-simpledb
模块中,它们在形成请求时遵循以下规则:相关问题 更多 >
编程相关推荐