【问题标题】:Seeking DynamoDb2 Connection Tutorial - getting error求 DynamoDb2 连接教程 - 报错
【发布时间】:2014-07-11 20:42:59
【问题描述】:

我已经开始使用 dynamodb2。

我需要执行以下操作: 1.连接发电机 2.按名称访问表 3. 扫描它们以获取特定值

我的问题主要是寻找一个好的例子。我还没有找到任何有效的方法。

我正在使用以下示例(请参阅:http://boto.readthedocs.org/en/latest/dynamodb2_tut.html):

def process_segment(segment=0, total_segments=10):
    # This method/function is executed in each thread, each getting its
    # own segment to process through.
    conn = boto.dynamodb2.connect_to_region(
        'us-east-1',
        aws_access_key_id=AWS_ACCESS_KEY_ID,
        aws_secret_access_key=AWS_SECRET_ACCESS_KEY
    )
    table = Table('users', connection=conn)

我有:

_aws_access_key_id=awsAccess.aws_access_key_id
_aws_secret_access_key=awsAccess.aws_secret_access_key
_aws_dynamo_region=awsAccess.aws_dynamo_region
credentials ={_aws_access_key_id,_aws_secret_access_key}

decompiled_dynamo_table="decompiled_swfs"
text_dynamo_table="decompiled_swf_text"
image_dynamo_table="images_decompiled"
_dynamo_table="decompiled_swf_text"

dynamoConn= dynamodb2.connect_to_region(region_name=_aws_dynamo_region,aws_access_key_id=_aws_access_key_id,aws_secret_access_key=_aws_secret_access_key)

我收到此错误:

pydev 调试器:开始 (pid: 95304) Traceback (最近调用 最后):文件 "/Applications/eclipse/plugins/org.python.pydev_3.4.1.201403181715/pysrc/pydevd.py", 第 1844 行,在 debugger.run(setup['file'], None, None) File "/Applications/eclipse/plugins/org.python.pydev_3.4.1.201403181715/pysrc/pydevd.py", 第 1372 行,运行中 pydev_imports.execfile(file, globals, locals) # 执行脚本文件 “/Users/tai/Documents/workspace/testSelenium/testS/init.py”,行 23,在 导入 dynamoAccess 文件“/Users/tai/Documents/workspace/testSelenium/testS/dynamoAccess.py”, 第 26 行,在 swfTable = Table(decompiled_dynamo_table, connection=dynamoConn) 文件 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/boto/dynamodb2/table.py", 第 107 行,在 init 中 self.connection = DynamoDBConnection() 文件“/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/boto/dynamodb2/layer1.py”, 第 183 行,在 init 中 super(DynamoDBConnection, self).init(**kwargs) 文件 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/boto/connection.py", 第 1073 行,在 init 中 profile_name=profile_name) 文件 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/boto/connection.py", 第 572 行,在 init 中 主机、配置、self.provider、self._required_auth_capability()) 文件 "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/boto/auth.py", 第 883 行,在 get_auth_handler 中 '检查您的凭据' % (len(names), str(names))) boto.exception.NoAuthHandlerFound: 没有处理程序准备好 认证。检查了 1 个处理程序。 ['HmacAuthV4Handler'] 检查 您的凭据

我检查了 _aws_secret_access_key、_aws_access_key_id 等的值是否正确。它们是字符串。有什么不同?有人知道更好的例子或如何解决这个问题吗?

【问题讨论】:

    标签: python boto amazon-dynamodb


    【解决方案1】:

    发现我的错误。

    我在 us-east 中传递区域,但是 dynamodb2 库正在寻找 us-east-1。

    如果您遇到类似这样的错误,则问题可能不是您的 id/key,因为它们已经过测试,而不是位置本身没有被检查。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-11-28
      • 1970-01-01
      • 2012-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多