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