當前位置: 首頁>>代碼示例>>Python>>正文


Python GoogleCredentials._get_implicit_credentials方法代碼示例

本文整理匯總了Python中oauth2client.client.GoogleCredentials._get_implicit_credentials方法的典型用法代碼示例。如果您正苦於以下問題:Python GoogleCredentials._get_implicit_credentials方法的具體用法?Python GoogleCredentials._get_implicit_credentials怎麽用?Python GoogleCredentials._get_implicit_credentials使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在oauth2client.client.GoogleCredentials的用法示例。


在下文中一共展示了GoogleCredentials._get_implicit_credentials方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _get_implicit_credentials

# 需要導入模塊: from oauth2client.client import GoogleCredentials [as 別名]
# 或者: from oauth2client.client.GoogleCredentials import _get_implicit_credentials [as 別名]
def _get_implicit_credentials(cls):
        """Gets credentials implicitly from the environment.

        Checks environment in order of precedence:
        - Google App Engine (production and testing)
        - Environment variable GOOGLE_APPLICATION_CREDENTIALS pointing to
          a file with stored credentials information.
        - Stored "well known" file associated with `gcloud` command line tool.
        - Google Compute Engine production environment.

        Raises:
            ApplicationDefaultCredentialsError: raised when the credentials
                                                fail to be retrieved.
        """
        # Environ checks (in order).
        environ_checkers = [
            cls._implicit_credentials_from_gae,
            cls._implicit_credentials_from_files,
            cls._implicit_credentials_from_gce,
        ]

        for checker in environ_checkers:
            credentials = checker()
            if credentials is not None:
                return credentials

        # If no credentials, fail.
        raise ApplicationDefaultCredentialsError(ADC_HELP_MSG) 
開發者ID:Deltares,項目名稱:aqua-monitor,代碼行數:30,代碼來源:client.py

示例2: get_application_default

# 需要導入模塊: from oauth2client.client import GoogleCredentials [as 別名]
# 或者: from oauth2client.client.GoogleCredentials import _get_implicit_credentials [as 別名]
def get_application_default():
        """Get the Application Default Credentials for the current environment.

        Raises:
            ApplicationDefaultCredentialsError: raised when the credentials
                                                fail to be retrieved.
        """
        return GoogleCredentials._get_implicit_credentials() 
開發者ID:Deltares,項目名稱:aqua-monitor,代碼行數:10,代碼來源:client.py

示例3: _get_implicit_credentials

# 需要導入模塊: from oauth2client.client import GoogleCredentials [as 別名]
# 或者: from oauth2client.client.GoogleCredentials import _get_implicit_credentials [as 別名]
def _get_implicit_credentials(cls):
        """Gets credentials implicitly from the environment.

        Checks environment in order of precedence:
        - Environment variable GOOGLE_APPLICATION_CREDENTIALS pointing to
          a file with stored credentials information.
        - Stored "well known" file associated with `gcloud` command line tool.
        - Google App Engine (production and testing)
        - Google Compute Engine production environment.

        Raises:
            ApplicationDefaultCredentialsError: raised when the credentials
                                                fail to be retrieved.
        """
        # Environ checks (in order).
        environ_checkers = [
            cls._implicit_credentials_from_files,
            cls._implicit_credentials_from_gae,
            cls._implicit_credentials_from_gce,
        ]

        for checker in environ_checkers:
            credentials = checker()
            if credentials is not None:
                return credentials

        # If no credentials, fail.
        raise ApplicationDefaultCredentialsError(ADC_HELP_MSG) 
開發者ID:fniephaus,項目名稱:alfred-gmail,代碼行數:30,代碼來源:client.py


注:本文中的oauth2client.client.GoogleCredentials._get_implicit_credentials方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。