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


Python exceptions.UnknownCredentialError方法代码示例

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


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

示例1: insert_before

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import UnknownCredentialError [as 别名]
def insert_before(self, name, credential_provider):
        """
        Inserts a new instance of ``CredentialProvider`` into the chain that
        will be tried before an existing one.

        :param name: The short name of the credentials you'd like to insert the
            new credentials before. (ex. ``env`` or ``config``). Existing names
            & ordering can be discovered via ``self.available_methods``.
        :type name: string

        :param cred_instance: An instance of the new ``Credentials`` object
            you'd like to add to the chain.
        :type cred_instance: A subclass of ``Credentials``
        """
        try:
            offset = [p.METHOD for p in self.providers].index(name)
        except ValueError:
            raise UnknownCredentialError(name=name)
        self.providers.insert(offset, credential_provider) 
开发者ID:skarlekar,项目名称:faces,代码行数:21,代码来源:credentials.py

示例2: get_provider

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import UnknownCredentialError [as 别名]
def get_provider(self, name):
        """Return a credential provider by name.

        :type name: str
        :param name: The name of the provider.

        :raises UnknownCredentialError: Raised if no
            credential provider by the provided name
            is found.
        """
        return self.providers[self._get_provider_offset(name)] 
开发者ID:skarlekar,项目名称:faces,代码行数:13,代码来源:credentials.py

示例3: _get_provider_offset

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import UnknownCredentialError [as 别名]
def _get_provider_offset(self, name):
        try:
            return [p.METHOD for p in self.providers].index(name)
        except ValueError:
            raise UnknownCredentialError(name=name) 
开发者ID:skarlekar,项目名称:faces,代码行数:7,代码来源:credentials.py

示例4: _get_provider

# 需要导入模块: from botocore import exceptions [as 别名]
# 或者: from botocore.exceptions import UnknownCredentialError [as 别名]
def _get_provider(self, canonical_name):
        """Return a credential provider by its canonical name.

        :type canonical_name: str
        :param canonical_name: The canonical name of the provider.

        :raises UnknownCredentialError: Raised if no
            credential provider by the provided name
            is found.
        """
        provider = self._get_provider_by_canonical_name(canonical_name)

        # The AssumeRole provider should really be part of the SharedConfig
        # provider rather than being its own thing, but it is not. It is
        # effectively part of both the SharedConfig provider and the
        # SharedCredentials provider now due to the way it behaves.
        # Therefore if we want either of those providers we should return
        # the AssumeRole provider with it.
        if canonical_name.lower() in ['sharedconfig', 'sharedcredentials']:
            assume_role_provider = self._get_provider_by_method('assume-role')
            if assume_role_provider is not None:
                # The SharedConfig or SharedCredentials provider may not be
                # present if it was removed for some reason, but the
                # AssumeRole provider could still be present. In that case,
                # return the assume role provider by itself.
                if provider is None:
                    return assume_role_provider

                # If both are present, return them both as a
                # CredentialResolver so that calling code can treat them as
                # a single entity.
                return CredentialResolver([assume_role_provider, provider])

        if provider is None:
            raise UnknownCredentialError(name=canonical_name)

        return provider 
开发者ID:QData,项目名称:deepWordBug,代码行数:39,代码来源:credentials.py


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