def RenderHttpResponse(request):
 start_time = time.time()
 response = HTTP_REQUEST_HANDLER.HandleRequest(request)
 total_time = (time.time() - start_time)
 log.LOGGER.LogHttpApiCall(request, response)
 method_name = response.get('X-API-Method', 'unknown')
 if (response.status_code == 200):
  status = 'SUCCESS'
 elif (response.status_code == 403):
  status = 'FORBIDDEN'
 elif (response.status_code == 404):
  status = 'NOT_FOUND'
 elif (response.status_code == 501):
  status = 'NOT_IMPLEMENTED'
 else:
  status = 'SERVER_ERROR'
 if (request.method == 'HEAD'):
  metric_name = 'api_access_probe_latency'
 else:
  metric_name = 'api_method_latency'
 stats.STATS.RecordEvent(metric_name, total_time, fields=(method_name, 'http', status))
 return response

def RenderHttpResponse ( request ) : start_time = time . time ( ) response = HTTP_REQUEST_HANDLER . HandleRequest ( request ) total_time = ( time . time ( ) - start_time ) log . LOGGER . LogHttpApiCall ( request , response ) method_name = response . get ( 'X-API-Method' , 'unknown' ) if ( response . status_code == 200 ) : status = 'SUCCESS' elif ( response . status_code == 403 ) : status = 'FORBIDDEN' elif ( response . status_code == 404 ) : status = 'NOT_FOUND' elif ( response . status_code == 501 ) : status = 'NOT_IMPLEMENTED' else : status = 'SERVER_ERROR' if ( request . method == 'HEAD' ) : metric_name = 'api_access_probe_latency' else : metric_name = 'api_method_latency' stats . STATS . RecordEvent ( metric_name , total_time , fields = ( method_name , 'http' , status ) ) return response
renders http response to a given http request .