当前位置: 首页>>代码示例>>Python>>正文


Python DynamoDBConnection.connect_to_region方法代码示例

本文整理汇总了Python中dynamo3.DynamoDBConnection.connect_to_region方法的典型用法代码示例。如果您正苦于以下问题:Python DynamoDBConnection.connect_to_region方法的具体用法?Python DynamoDBConnection.connect_to_region怎么用?Python DynamoDBConnection.connect_to_region使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dynamo3.DynamoDBConnection的用法示例。


在下文中一共展示了DynamoDBConnection.connect_to_region方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: initialize

# 需要导入模块: from dynamo3 import DynamoDBConnection [as 别名]
# 或者: from dynamo3.DynamoDBConnection import connect_to_region [as 别名]
    def initialize(self, region='us-west-1', host='localhost', port=8000,
                   access_key=None, secret_key=None, config_dir=None):
        """ Set up the repl for execution. """
        # Tab-complete names with a '-' in them
        import readline
        delims = set(readline.get_completer_delims())
        if '-' in delims:
            delims.remove('-')
            readline.set_completer_delims(''.join(delims))

        self._conf_dir = (config_dir or
                          os.path.join(os.environ.get('HOME', '.'), '.config'))
        self.session = botocore.session.get_session()
        if access_key:
            self.session.set_credentials(access_key, secret_key)
        if region == 'local':
            conn = DynamoDBConnection.connect_to_host(host, port,
                                                      session=self.session)
        else:
            conn = DynamoDBConnection.connect_to_region(region, self.session)
        self.engine = FragmentEngine(conn)

        conf = self.load_config()
        display_name = conf.get('display')
        if display_name is not None:
            self.display = DISPLAYS[display_name]
        else:
            self.display = get_default_display()
        self.formatter = SmartFormat(pagesize=conf.get('pagesize', 1000),
                                     width=conf.get('width', 80))
        for line in conf.get('autorun', []):
            six.exec_(line, self.engine.scope)
开发者ID:cce,项目名称:dql,代码行数:34,代码来源:cli.py

示例2: do_use

# 需要导入模块: from dynamo3 import DynamoDBConnection [as 别名]
# 或者: from dynamo3.DynamoDBConnection import connect_to_region [as 别名]
    def do_use(self, region, host='localhost', port=8000):
        """
        Switch the AWS region

        You may also specify 'use local host=localhost port=8000' to use the
        DynamoDB Local service

        """
        if region == 'local':
            conn = DynamoDBConnection.connect_to_host(
                host, port, session=self.session)
        else:
            conn = DynamoDBConnection.connect_to_region(region, self.session)
        self.engine.connection = conn
开发者ID:cce,项目名称:dql,代码行数:16,代码来源:cli.py

示例3: test_connect_to_region_creds_old

# 需要导入模块: from dynamo3 import DynamoDBConnection [as 别名]
# 或者: from dynamo3.DynamoDBConnection import connect_to_region [as 别名]
 def test_connect_to_region_creds_old(self):
     """ Can connect to a dynamo region with credentials """
     conn = DynamoDBConnection.connect_to_region(
         'us-west-1', access_key='abc', secret_key='12345')
     self.assertIsNotNone(conn.host)
开发者ID:normalex,项目名称:dynamo3,代码行数:7,代码来源:__init__.py

示例4: test_connect_to_region_old

# 需要导入模块: from dynamo3 import DynamoDBConnection [as 别名]
# 或者: from dynamo3.DynamoDBConnection import connect_to_region [as 别名]
 def test_connect_to_region_old(self):
     """ Can connect to a dynamo region """
     conn = DynamoDBConnection.connect_to_region('us-west-1')
     self.assertIsNotNone(conn.host)
开发者ID:normalex,项目名称:dynamo3,代码行数:6,代码来源:__init__.py

示例5: connect_to_region

# 需要导入模块: from dynamo3 import DynamoDBConnection [as 别名]
# 或者: from dynamo3.DynamoDBConnection import connect_to_region [as 别名]
 def connect_to_region(self, region, *args, **kwargs):
     """ Connect the engine to an AWS region """
     self.connection = DynamoDBConnection.connect_to_region(region, *args,
                                                            **kwargs)
开发者ID:cce,项目名称:dql,代码行数:6,代码来源:engine.py

示例6: connect_to_region

# 需要导入模块: from dynamo3 import DynamoDBConnection [as 别名]
# 或者: from dynamo3.DynamoDBConnection import connect_to_region [as 别名]
 def connect_to_region(self, region, **kwargs):
     """ Connect to an AWS region """
     self.dynamo = DynamoDBConnection.connect_to_region(region, **kwargs)
开发者ID:zzugg,项目名称:flywheel,代码行数:5,代码来源:engine.py


注:本文中的dynamo3.DynamoDBConnection.connect_to_region方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。