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"]
评论列表
文章目录