def _to_json(self, resp):
try:<EOL><INDENT>json = resp.json()<EOL><DEDENT>except ValueError as e:<EOL><INDENT>reason = "<STR_LIT>"<EOL>raise APIError(reason.format(repr(e)))<EOL><DEDENT>return json<EOL>
Extract json from a response.
Assumes response is valid otherwise.
Internal use only.