def do_action_with_exception(self, acs_request):
# set server response format as json, because thie function will
# parse the response so which format doesn't matter
acs_request.set_accept_format('json')
status, headers, body = self._implementation_of_do_action(acs_request)
request_id = None
ret = body
try:
body_obj = json.loads(body.decode('utf-8'))
request_id = body_obj.get('RequestId')
ret = body_obj
except ValueError:
# in case the response body is not a json string, return the raw data instead
pass
if status != http.client.OK:
server_error_code, server_error_message = self._parse_error_info_from_response_body(body)
raise ServerException(server_error_code, server_error_message, http_status=status, request_id=request_id)
return body
评论列表
文章目录