python - boto 连接到 Mturk 时出错

标签 python python-2.7 boto mechanicalturk

我正在开发 boto 版本 2.6.0 。我在连接 mturk 时遇到问题。
我的代码是:

mturk_connection = MTurkConnection(aws_access_key_id=ACCESS_ID, aws_secret_access_key=SECRET_KEY, is_secure = True, host = HOST)
print mturk_connection.get_account_balance()

我收到的错误消息是:

boto.mturk.connection.MTurkRequestError: MTurkRequestError: 200 OK  
<?xml version="1.0"?>
    <GetAccountBalanceResponse>

            <OperationRequest>
            <RequestId>06783745-3810-49d3-8235-d8a95f36b747</RequestId>
            <Errors>
                <Error>
                    <Code>AWS.BadClaimsSupplied</Code>
                    <Message>The specified claims are invalid.   Based on your request, your signature should be generated using the following string: ActionGetAccountBalanceAWSAccessKeyIdAKIAQEQC5M72KQQSignatureVersion1Timestamp2012-11-15T06:10:07ZVersion2012-03-25.  Check to make sure your system clock and timezone is not incorrect.  Our current system time: 2012-11-15T06:10:07Z.  (1352959808079 s)</Message>        
                    <Data>
                            <Key>CustomerSignature</Key>
                            <Value>eMfIjDkM7v2/4fp4WqTOjtaFGDp1/Ydr2TTVV+oP5m0=</Value>
                            </Data><Data>
                            <Key>StringToSign</Key>
                                <Value>ActionGetAccountBalanceAWSAccessKeyIdAKIAJD3HEQEQC5M72KQQSignatureVersion1Timestamp2012-11-15T06:10:07ZVersion2012-03-25</Value>
                            </Data><Data>
                            <Key>SystemTime</Key>
                            <Value>2012-11-15T06:10:07Z</Value>
                    </Data>
            </Error>
        </Errors>
    </OperationRequest>

</GetAccountBalanceResponse>

我尝试找出错误的根源,但失败了。请提出一些建议。

最佳答案

我猜您使用的是较旧版本的 boto,其中错误修复 #1057 尚未更新。请检查第 525 行是否有 'init' 方法。如果您没有找到 . . 从 github 重新克隆 boto 存储库再次并使用命令安装 -

python setup.py install

希望您的问题得到解决。

关于python - boto 连接到 Mturk 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13394605/

相关文章:

python s3 使用 boto,说 'attribute error: ' str' 对象没有属性 'connection'

python - 在 python 中使用迭代器?

Python-按常量列标题排列 CSV 文件的不同行

java - 在这种情况下如何为hadoop编写partioner?

python - 如何在 Python 中检查双端队列长度

python - 替换 Python 2.7 中的打印语句

python - 使用 django-storages 和 S3boto 设置文件权限不公开

django - URL参数中显示的签名/有效期/访问 key ID。 Django/Boto/S3

python - 为什么使用 __iter__() 方法在实例上调用 list() 会导致递归?

python - Windows 上 python 的长路径 - os.stat() 相对路径失败?