endpoint.py 文件源码

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

项目:Treehacks 作者: andrewsy97 项目源码 文件源码
def response(cls, r):
        """Extract the data from the API response *r*.

        This method essentially strips the actual response of the envelope
        while raising an :class:`~errors.ApiError` if it contains one or more
        errors.

        :param r: the HTTP response from an API call
        :type r: :class:`requests.Response`
        :returns: API response data
        :rtype: json
        """
        try:
            data = r.json()
        except ValueError:
            raise errors.ApiError(r)
        if data['meta'].get("errors"):
            raise errors.ApiError(data['meta'])
        return data["response"]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号