'Get a connection from the pool and perform an HTTP request. This is the
lowest level call for making a request, so you\'ll need to specify all
the raw details.
.. note::
More commonly, it\'s appropriate to use a convenience method provided
by :class:`.RequestMethods`, such as :meth:`request`.
.. note::
`release_conn` will only behave as expected if
`preload_content=False` because we want to make
`preload_content=False` the default behaviour someday soon without
breaking backwards compatibility.
:param method:
HTTP request method (such as GET, POST, PUT, etc.)
:param body:
Data to send in the request body (useful for creating
POST requests, see HTTPConnectionPool.post_url for
more convenience).
:param headers:
Dictionary of custom headers to send, such as User-Agent,
If-None-Match, etc. If None, pool headers are used. If provided,
these headers completely replace any pool-specific headers.
:param retries:
Number of retries to allow before raising a MaxRetryError exception.
:param redirect:
If True, automatically handle redirects (status codes 301, 302,
303, 307). Each redirect counts as a retry.
:param assert_same_host:
If ``True``, will make sure that the host of the pool requests is
consistent else will raise HostChangedError. When False, you can
use the pool on an HTTP proxy and request foreign hosts.
:param timeout:
If specified, overrides the default timeout for this one request.
:param pool_timeout:
If set and the pool is set to block=True, then this method will
block for ``pool_timeout`` seconds and raise EmptyPoolError if no
connection is available within the time period.
:param release_conn:
If False, then the urlopen call will not release the connection
back into the pool once a response is received (but will release if
you read the entire contents of the response such as when
`preload_content=True`). This is useful if you\'re not preloading
the response\'s content immediately. You will need to call
``r.release_conn()`` on the response ``r`` to return the connection
back into the pool. If None, it takes the value of
``response_kw.get(\'preload_content\', True)``.
:param \**response_kw:
Additional parameters are passed to
:meth:`urllib3.response.HTTPResponse.from_httplib`'

def urlopen(self, method, url, body=None, headers=None, retries=3, redirect=True, assert_same_host=True, timeout=_Default, pool_timeout=None, release_conn=None, **response_kw):

    if (headers is None):
        headers = self.headers
    if (retries < 0):
        raise MaxRetryError(self, url)
    if (timeout is _Default):
        timeout = self.timeout
    if (release_conn is None):
        release_conn = response_kw.get('preload_content', True)
    if (assert_same_host and (not self.is_same_host(url))):
        host = ('%s://%s' % (self.scheme, self.host))
        if self.port:
            host = ('%s:%d' % (host, self.port))
        raise HostChangedError(self, url, (retries - 1))
    conn = None
    try:
        conn = self._get_conn(timeout=pool_timeout)
        httplib_response = self._make_request(conn, method, url, timeout=timeout, body=body, headers=headers)
        response_conn = ((not release_conn) and conn)
        response = HTTPResponse.from_httplib(httplib_response, pool=self, connection=response_conn, **response_kw)
    except Empty as e:
        raise TimeoutError(self, ('Request    timed    out.    (pool_timeout=%s)' % pool_timeout))
    except SocketTimeout as e:
        raise TimeoutError(self, ('Request    timed    out.    (timeout=%s)' % timeout))
    except BaseSSLError as e:
        raise SSLError(e)
    except CertificateError as e:
        raise SSLError(e)
    except (HTTPException, SocketError) as e:
        conn = None
        err = e
        if (retries == 0):
            raise MaxRetryError(self, url, e)
    finally:
        if release_conn:
            self._put_conn(conn)
    if (not conn):
        log.warn(("Retrying    (%d    attempts    remain)    after    connection    broken    by    '%r':    %s" % (retries, err, url)))
        return self.urlopen(method, url, body, headers, (retries - 1), redirect, assert_same_host, timeout=timeout, pool_timeout=pool_timeout, release_conn=release_conn, **response_kw)
    redirect_location = (redirect and response.get_redirect_location())
    if redirect_location:
        if (response.status == 303):
            method = 'GET'
        log.info(('Redirecting    %s    ->    %s' % (url, redirect_location)))
        return self.urlopen(method, redirect_location, body, headers, (retries - 1), redirect, assert_same_host, timeout=timeout, pool_timeout=pool_timeout, release_conn=release_conn, **response_kw)
    return response
