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


Python exceptions.DataNotFoundError方法代码示例

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


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

示例1: determine_latest_version

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def determine_latest_version(self, service_name, type_name):
        """Find the latest API version available for a service.

        :type service_name: str
        :param service_name: The name of the service.

        :type type_name: str
        :param type_name: The type of the service (service-2,
            paginators-1, waiters-2, etc).  This is needed because
            the latest API version available can depend on the service
            type.  For example, the latest API version available for
            a resource-1.json file may not be the latest API version
            available for a services-2.json file.

        :rtype: str
        :return: The latest API version.  If the service does not exist
            or does not have any available API data, then a
            ``DataNotFoundError`` exception will be raised.

        """
        return max(self.list_api_versions(service_name, type_name)) 
开发者ID:skarlekar,项目名称:faces,代码行数:23,代码来源:loaders.py

示例2: load_data

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def load_data(self, name):
        """Load data given a data path.

        This is a low level method that will search through the various
        search paths until it's able to load a value.  This is typically
        only needed to load *non* model files (such as _endpoints and
        _retry).  If you need to load model files, you should prefer
        ``load_service_model``.

        :type name: str
        :param name: The data path, i.e ``ec2/2015-03-01/service-2``.

        :return: The loaded data.  If no data could be found then
            a DataNotFoundError is raised.

        """
        for possible_path in self._potential_locations(name):
            found = self.file_loader.load_file(possible_path)
            if found is not None:
                return found
        # We didn't find anything that matched on any path.
        raise DataNotFoundError(data_path=name) 
开发者ID:skarlekar,项目名称:faces,代码行数:24,代码来源:loaders.py

示例3: iam_client

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def iam_client(self):
        if not self.iam:
            for attempt in count():
                try:
                    self.iam = boto3.client('iam')
                    break
                except DataNotFoundError:
                    logging.exception('DataNotFoundError when trying to get the iam client.')
                    t = self.retry_policy(attempt)
                    if t is None:
                        logging.info('Not retrying')
                        raise LambdaInvocationException('Exhausted retries getting iam client')
                    logging.info('Retrying in {} seconds'.format(t))
                    sleep(t)
                    logging.info('Retrying now')
        return self.iam 
开发者ID:lyft,项目名称:python-blessclient,代码行数:18,代码来源:bless_aws.py

示例4: client_api

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def client_api(self, section):
        examples = None
        try:
            examples = self.get_examples(self._service_name)
        except DataNotFoundError:
            pass

        ClientDocumenter(self._client, examples).document_client(section) 
开发者ID:skarlekar,项目名称:faces,代码行数:10,代码来源:service.py

示例5: paginator_api

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def paginator_api(self, section):
        try:
            service_paginator_model = self._session.get_paginator_model(
                self._service_name)
        except DataNotFoundError:
            return
        paginator_documenter = PaginatorDocumenter(
            self._client, service_paginator_model)
        paginator_documenter.document_paginators(section) 
开发者ID:skarlekar,项目名称:faces,代码行数:11,代码来源:service.py

示例6: can_paginate

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def can_paginate(self, operation_name):
        """Check if an operation can be paginated.

        :type operation_name: string
        :param operation_name: The operation name.  This is the same name
            as the method name on the client.  For example, if the
            method name is ``create_foo``, and you'd normally invoke the
            operation as ``client.create_foo(**kwargs)``, if the
            ``create_foo`` operation can be paginated, you can use the
            call ``client.get_paginator("create_foo")``.

        :return: ``True`` if the operation can be paginated,
            ``False`` otherwise.

        """
        if 'page_config' not in self._cache:
            try:
                page_config = self._loader.load_service_model(
                    self._service_model.service_name,
                    'paginators-1',
                    self._service_model.api_version)['pagination']
                self._cache['page_config'] = page_config
            except DataNotFoundError:
                self._cache['page_config'] = {}
        actual_operation_name = self._PY_TO_OP_NAME[operation_name]
        return actual_operation_name in self._cache['page_config'] 
开发者ID:skarlekar,项目名称:faces,代码行数:28,代码来源:client.py

示例7: _get_waiter_config

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def _get_waiter_config(self):
        if 'waiter_config' not in self._cache:
            try:
                waiter_config = self._loader.load_service_model(
                    self._service_model.service_name,
                    'waiters-2',
                    self._service_model.api_version)
                self._cache['waiter_config'] = waiter_config
            except DataNotFoundError:
                self._cache['waiter_config'] = {}
        return self._cache['waiter_config'] 
开发者ID:skarlekar,项目名称:faces,代码行数:13,代码来源:client.py

示例8: _find_extras

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def _find_extras(self, service_name, type_name, api_version):
        """Creates an iterator over all the extras data."""
        for extras_type in self.extras_types:
            extras_name = '%s.%s-extras' % (type_name, extras_type)
            full_path = os.path.join(service_name, api_version, extras_name)

            try:
                yield self.load_data(full_path)
            except DataNotFoundError:
                pass 
开发者ID:skarlekar,项目名称:faces,代码行数:12,代码来源:loaders.py

示例9: client_api

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def client_api(self, section):
        examples = None
        try:
            examples = self.get_examples(self._service_name)
        except DataNotFoundError:
            pass

        Boto3ClientDocumenter(self._client, examples).document_client(section) 
开发者ID:skarlekar,项目名称:faces,代码行数:10,代码来源:service.py

示例10: list_api_versions

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import DataNotFoundError [as 别名]
def list_api_versions(self, service_name, type_name):
        """List all API versions available for a particular service type

        :type service_name: str
        :param service_name: The name of the service

        :type type_name: str
        :param type_name: The type name for the service (i.e service-2,
            paginators-1, etc.)

        :rtype: list
        :return: A list of API version strings in sorted order.

        """
        known_api_versions = set()
        for possible_path in self._potential_locations(service_name,
                                                       must_exist=True,
                                                       is_dir=True):
            for dirname in os.listdir(possible_path):
                full_path = os.path.join(possible_path, dirname, type_name)
                # Only add to the known_api_versions if the directory
                # contains a service-2, paginators-1, etc. file corresponding
                # to the type_name passed in.
                if self.file_loader.exists(full_path):
                    known_api_versions.add(dirname)
        if not known_api_versions:
            raise DataNotFoundError(data_path=service_name)
        return sorted(known_api_versions) 
开发者ID:skarlekar,项目名称:faces,代码行数:30,代码来源:loaders.py


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