def urlopen(self, method, url, redirect=True, **kw):
u = parse_url(url)<EOL>conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)<EOL>kw['<STR_LIT>'] = False<EOL>kw['<STR_LIT>'] = False<EOL>if '<STR_LIT>' not in kw:<EOL><INDENT>kw['<STR_LIT>'] = self.headers<EOL><DEDENT>if self.proxy is not None and u.scheme == "<STR_LIT:http>":<EOL><INDENT>response = conn.urlopen(method, url, **kw)<EOL><DEDENT>else:<EOL><INDENT>response = conn.urlopen(method, u.request_uri, **kw)<EOL><DEDENT>redirect_location = redirect and response.get_redirect_location()<EOL>if not redirect_location:<EOL><INDENT>return response<EOL><DEDENT>redirect_location = urljoin(url, redirect_location)<EOL>if response.status == <NUM_LIT>:<EOL><INDENT>method = '<STR_LIT:GET>'<EOL><DEDENT>retries = kw.get('<STR_LIT>')<EOL>if not isinstance(retries, Retry):<EOL><INDENT>retries = Retry.from_int(retries, redirect=redirect)<EOL><DEDENT>try:<EOL><INDENT>retries = retries.increment(method, url, response=response, _pool=conn)<EOL><DEDENT>except MaxRetryError:<EOL><INDENT>if retries.raise_on_redirect:<EOL><INDENT>raise<EOL><DEDENT>return response<EOL><DEDENT>kw['<STR_LIT>'] = retries<EOL>kw['<STR_LIT>'] = redirect<EOL>log.info("<STR_LIT>" % (url, redirect_location))<EOL>return self.urlopen(method, redirect_location, **kw)<EOL>
Same as :meth:`urllib3.connectionpool.HTTPConnectionPool.urlopen`
with custom cross-host redirect logic and only sends the request-uri
portion of the ``url``.

The given ``url`` parameter must be absolute, such that an appropriate
:class:`urllib3.connectionpool.ConnectionPool` can be chosen for it.