def build_response(response, request):
 dict_obj = {}
 dict_obj['path'] = urlparse.unquote(request.path)
 dict_obj['status'] = response.status_code
 dict_obj['headers'] = dict(response.headers)
 body = ''
 if (request.method != 'HEAD'):
  try:
   body = response.json
  except ValueError:
   body = response.body
 dict_obj['body'] = body
 return dict_obj

def build_response ( response , request ) : dict_obj = { } dict_obj [ 'path' ] = urlparse . unquote ( request . path ) dict_obj [ 'status' ] = response . status_code dict_obj [ 'headers' ] = dict ( response . headers ) body = '' if ( request . method != 'HEAD' ) : try : body = response . json except ValueError : body = response . body dict_obj [ 'body' ] = body return dict_obj
transform a :class:pyramid .