def getresponse(self, buffering=False):
    """Get the response from the server.

    App Engine Note: buffering is ignored.
    """
    # net.proto.ProcotolBuffer relies on httplib so importing urlfetch at the
    # module level causes a failure on prod. That means the import needs to be
    # lazy.
    from google.appengine.api import urlfetch
    import socket  # Cannot be done at global scope due to circular import.

    if self.port and self.port != self.default_port:
      host = '%s:%s' % (self.host, self.port)
    else:
      host = self.host
    if not self._url.startswith(self._protocol):
      url = '%s://%s%s' % (self._protocol, host, self._url)
    else:
      url = self._url
    headers = dict(self.headers)

    if self.timeout in [_GLOBAL_DEFAULT_TIMEOUT,
                        socket._GLOBAL_DEFAULT_TIMEOUT]:
      deadline = socket.getdefaulttimeout()
    else:
      deadline = self.timeout

    try:
      method = self._method_map[self._method.upper()]
    except __HOLE__:
      raise ValueError('%r is an unrecognized HTTP method' % self._method)

    try:
      # The Python Standard Library doesn't validate certificates so don't
      # validate them here either.  But some libraries (httplib2, possibly
      # others) use an alternate technique where the fetch function does not
      # have a validate_certificate argument so only provide it when supported.
      argspec = self._getargspec(self._fetch)
      extra_kwargs = (
          {'validate_certificate': False}
          if argspec.keywords or 'validate_certificate' in argspec.args
          else {})
      fetch_response = self._fetch(url,
                                   self._body,
                                   method, headers,
                                   self._allow_truncated,
                                   self._follow_redirects,
                                   deadline,
                                   **extra_kwargs)
    except urlfetch.InvalidURLError, e:
      raise InvalidURL(str(e))
    except (urlfetch.ResponseTooLargeError, urlfetch.DeadlineExceededError), e:
      raise HTTPException(str(e))
    except urlfetch.SSLCertificateError, e:
      # Should be ssl.SSLError but the ssl module isn't available.
      # Continue to support this exception for versions of _fetch that do not
      # support validate_certificates. Also, in production App Engine defers
      # specific semantics so leaving this in just in case.
      raise HTTPException(str(e))
    except urlfetch.DownloadError, e:
      # One of the following occured: UNSPECIFIED_ERROR, FETCH_ERROR
      raise socket.error(
          'An error occured while connecting to the server: %s' % e)

    response = self.response_class(fetch_response, method=method)
    response.begin()
    self.close()
    return response
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/dist27/gae_override/httplib.py/HTTPConnection.getresponse