__init__.py 文件源码

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

项目:oauth2l 作者: google 项目源码 文件源码
def _GetTokenInfo(access_token):
    """Return the list of valid scopes for the given token as a list."""
    url = _OAUTH2_TOKENINFO_TEMPLATE.format(access_token=access_token)
    h = httplib2.Http()
    response, content = h.request(url)
    if 'status' not in response:
        raise ValueError('No status in HTTP response')
    status_code = int(response['status'])
    if status_code not in [http_client.OK, http_client.BAD_REQUEST]:
        msg = (
            'Error making HTTP request to <{}>: status <{}>, '
            'content <{}>'.format(url, response['status'], content))
        raise ValueError(msg)
    if status_code == http_client.BAD_REQUEST:
        return {}
    return json.loads(_AsText(content))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号