當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。