helpers.py 文件源码

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

项目:google-auth-library-python-oauthlib 作者: GoogleCloudPlatform 项目源码 文件源码
def session_from_client_secrets_file(client_secrets_file, scopes, **kwargs):
    """Creates a :class:`requests_oauthlib.OAuth2Session` instance from a
    Google-format client secrets file.

    Args:
        client_secrets_file (str): The path to the `client secrets`_ .json
            file.
        scopes (Sequence[str]): The list of scopes to request during the
            flow.
        kwargs: Any additional parameters passed to
            :class:`requests_oauthlib.OAuth2Session`

    Returns:
        Tuple[requests_oauthlib.OAuth2Session, Mapping[str, Any]]: The new
            oauthlib session and the validated client configuration.

    .. _client secrets:
        https://developers.google.com/api-client-library/python/guide
        /aaa_client_secrets
    """
    with open(client_secrets_file, 'r') as json_file:
        client_config = json.load(json_file)

    return session_from_client_config(client_config, scopes, **kwargs)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号