__init__.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:oauth2l 作者: google 项目源码 文件源码
def _GetApplicationDefaultCredentials(scopes):
    # There's a complication here: if the application default
    # credential returned to us is the token from the cloud SDK,
    # we need to ensure that our scopes are a subset of those
    # requested. In principle, we're a bit too strict here: eg if
    # a user requests just "bigquery", then the cloud-platform
    # scope suffices, but there's no programmatic way to check
    # this -- so we instead fail here.
    try:
        credentials = client.GoogleCredentials.get_application_default()
    except client.ApplicationDefaultCredentialsError:
        return None
    if credentials is not None:
        if not credentials.create_scoped_required():
            return credentials
        if set(scopes) <= _GCLOUD_SCOPES:
            return credentials.create_scoped(scopes)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号