'Call `request` with :mod:`urllib2` and process results.
:param request: :class:`urllib2.Request` instance
:param stream: Whether to stream response or retrieve it all at once
:type stream: ``bool``'

def __init__(self, request, stream=False):

    self.request = request
    self._stream = stream
    self.url = None
    self.raw = None
    self._encoding = None
    self.error = None
    self.status_code = None
    self.reason = None
    self.headers = CaseInsensitiveDictionary()
    self._content = None
    self._content_loaded = False
    self._gzipped = False
    try:
        self.raw = urllib2.urlopen(request)
    except urllib2.HTTPError as err:
        self.error = err
        try:
            self.url = err.geturl()
        except AttributeError:
            pass
        self.status_code = err.code
    else:
        self.status_code = self.raw.getcode()
        self.url = self.raw.geturl()
    self.reason = RESPONSES.get(self.status_code)
    if (not self.error):
        headers = self.raw.info()
        self.transfer_encoding = headers.getencoding()
        self.mimetype = headers.gettype()
        for key in headers.keys():
            self.headers[key.lower()] = headers.get(key)
        if (('gzip' in headers.get('content-encoding', '')) or ('gzip' in headers.get('transfer-encoding', ''))):
            self._gzipped = True
