(ResponseCls, r, **response_kw)
return resp
Given an :class:`httplib.HTTPResponse` instance ``r``, return a
        corresponding :class:`urllib3.response.HTTPResponse` object.

        Remaining parameters are passed to the HTTPResponse constructor, along
        with ``original_response=r``.
Given an :class:`httplib.HTTPResponse` instance ``r``, return a
        corresponding :class:`urllib3.response.HTTPResponse` object.
Given an : class : httplib . HTTPResponse instance r return a corresponding : class : urllib3 . response . HTTPResponse object .
def from_httplib(ResponseCls, r, **response_kw):
        """
        Given an :class:`httplib.HTTPResponse` instance ``r``, return a
        corresponding :class:`urllib3.response.HTTPResponse` object.

        Remaining parameters are passed to the HTTPResponse constructor, along
        with ``original_response=r``.
        """
        headers = r.msg

        if not isinstance(headers, HTTPHeaderDict):
            if PY3: # Python 3
                headers = HTTPHeaderDict(headers.items())
            else: # Python 2
                headers = HTTPHeaderDict.from_httplib(headers)

        # HTTPResponse objects in Python 3 don't have a .strict attribute
        strict = getattr(r, 'strict', 0)
        resp = ResponseCls(body=r,
                           headers=headers,
                           status=r.status,
                           version=r.version,
                           reason=r.reason,
                           strict=strict,
                           original_response=r,
                           **response_kw)
        return resp
def from_httplib ( ResponseCls , r , * * response_kw ) : headers = r . msg if not isinstance ( headers , HTTPHeaderDict ) : if PY3 : # Python 3 headers = HTTPHeaderDict ( headers . items ( ) ) else : # Python 2 headers = HTTPHeaderDict . from_httplib ( headers ) # HTTPResponse objects in Python 3 don't have a .strict attribute strict = getattr ( r , 'strict' , 0 ) resp = ResponseCls ( body = r , headers = headers , status = r . status , version = r . version , reason = r . reason , strict = strict , original_response = r , * * response_kw ) return resp