def Do(
      self, method, url,
      body=None, headers=None, output_filename=None,
      retry_on_status=DEFAULT_RETRY_HTTP_STATUS_CODES,
      attempt_times=DEFAULT_HTTP_ATTEMPTS, _open=open):
    """Make a request and return the response.

    Args:
      method: str, like 'GET' or 'POST'
      url: str, url like '/foo.html', not 'http://host/foo.html'
      body: str or dict or file, optional, body to send with request
      headers: dict, optional, headers to send with request
      output_filename: str, optional, filename to write response body to
      retry_on_status: list, default (500, 502, etc.), int status codes to
          retry upon receiving.
      attempt_times: int, default 4, how many times to attempt the request
      _open: func, optional, default builtin open, to open output_filename
    Returns:
      Response object
    Raises:
      NotImplementedError: if an unknown method is supplied
      HTTPError: if a connection level error occured
    """
    if method not in ['GET', 'POST', 'PUT', 'DELETE']:
      raise NotImplementedError('HTTP method %s' % method)

    if headers is None:
      headers = {}

    if output_filename:
      output_file = _open(output_filename, 'w')
    else:
      output_file = None

    n = 0
    while n < attempt_times:
      time.sleep(n * 5)
      n += 1
      logging.debug('Do(%s, %s) try #%d', method, url, n)
      try:
        response = self._DoRequestResponse(
            method, url, body=body, headers=headers, output_file=output_file)
      except HTTPError:
        logging.warning('HTTPError in Do(%s, %s)', method, url)
        if n == attempt_times:
          raise
      else:
        if response.status not in retry_on_status:
          break
        logging.warning('Retry status hit for Do(%s, %s)', method, url)

    if output_filename:
      output_file.close()

    return response
dataset/ETHPy150Open google/simian/src/simian/client/client.py/HttpsClient.Do/original