<h2 dir="auto">Expected Result</h2>
<p dir="auto">Displays the proxy IP address</p>

<h2 dir="auto">Actual Result</h2>
<p dir="auto">Traceback (most recent call last):<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 696, in urlopen<br>
self._prepare_proxy(conn)<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 964, in _prepare_proxy<br>
conn.connect()<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/urllib3/connection.py", line 371, in connect<br>
self._tunnel()<br>
File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.8/lib/python3.8/http/client.py", line 902, in _tunnel<br>
raise OSError("Tunnel connection failed: %d %s" % (code,<br>
OSError: Tunnel connection failed: 407 Proxy Authentication Required</p>
<p dir="auto">During handling of the above exception, another exception occurred:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/requests/adapters.py", line 440, in send<br>
resp = conn.urlopen(<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/urllib3/connectionpool.py", line 755, in urlopen<br>
retries = retries.increment(<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/urllib3/util/retry.py", line 574, in increment<br>
raise MaxRetryError(_pool, url, error or ResponseError(cause))<br>
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='ifconfig.me', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))</p>
<p dir="auto">During handling of the above exception, another exception occurred:</p>
<p dir="auto">Traceback (most recent call last):<br>
File "/Users/cheney/code/python/tools/test.py", line 17, in <br>
res = requests.get("<a href="https://ifconfig.me" rel="nofollow">https://ifconfig.me</a>", proxies=proxies)<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/requests/api.py", line 75, in get<br>
return request('get', url, params=params, **kwargs)<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/requests/api.py", line 61, in request<br>
return session.request(method=method, url=url, **kwargs)<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/requests/sessions.py", line 529, in request<br>
resp = self.send(prep, **send_kwargs)<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/requests/sessions.py", line 645, in send<br>
r = adapter.send(request, **kwargs)<br>
File "/Users/cheney/code/python/tools/venv/lib/python3.8/site-packages/requests/adapters.py", line 513, in send<br>
raise ProxyError(e, request=request)<br>
requests.exceptions.ProxyError: HTTPSConnectionPool(host='ifconfig.me', port=443): Max retries exceeded with url: / (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 407 Proxy Authentication Required')))</p>

<h2 dir="auto">Reproduction Steps</h2>
<p dir="auto">When using a proxy that requires basic authentication to access an HTTPS (not HTTP) address, the system gives an error. The code is as follows:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import requests

proxy_string = 'http://{}:{}@{}:{}'.format(username, password, proxyHost, proxyPort)
proxies = {&quot;http&quot;: proxy_string, &quot;https&quot;: proxy_string}
res = requests.get(&quot;https://ifconfig.me&quot;, proxies=proxies)
print(res.text)
"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">requests</span>

<span class="pl-s1">proxy_string</span> <span class="pl-c1">=</span> <span class="pl-s">'http://{}:{}@{}:{}'</span>.<span class="pl-en">format</span>(<span class="pl-s1">username</span>, <span class="pl-s1">password</span>, <span class="pl-s1">proxyHost</span>, <span class="pl-s1">proxyPort</span>)
<span class="pl-s1">proxies</span> <span class="pl-c1">=</span> {<span class="pl-s">"http"</span>: <span class="pl-s1">proxy_string</span>, <span class="pl-s">"https"</span>: <span class="pl-s1">proxy_string</span>}
<span class="pl-s1">res</span> <span class="pl-c1">=</span> <span class="pl-s1">requests</span>.<span class="pl-en">get</span>(<span class="pl-s">"https://ifconfig.me"</span>, <span class="pl-s1">proxies</span><span class="pl-c1">=</span><span class="pl-s1">proxies</span>)
<span class="pl-en">print</span>(<span class="pl-s1">res</span>.<span class="pl-s1">text</span>)</pre></div>
<p dir="auto">It should be noted that the same code can run normally in Windows system, but there are problems with MacOS</p>
<h2 dir="auto">System Information</h2>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ python -m requests.help"><pre class="notranslate"><code class="notranslate">$ python -m requests.help
</code></pre></div>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;chardet&quot;: {
    &quot;version&quot;: null
  },
  &quot;charset_normalizer&quot;: {
    &quot;version&quot;: &quot;2.0.10&quot;
  },
  &quot;cryptography&quot;: {
    &quot;version&quot;: &quot;&quot;
  },
  &quot;idna&quot;: {
    &quot;version&quot;: &quot;3.3&quot;
  },
  &quot;implementation&quot;: {
    &quot;name&quot;: &quot;CPython&quot;,
    &quot;version&quot;: &quot;3.8.2&quot;
  },
  &quot;platform&quot;: {
    &quot;release&quot;: &quot;21.1.0&quot;,
    &quot;system&quot;: &quot;Darwin&quot;
  },
  &quot;pyOpenSSL&quot;: {
    &quot;openssl_version&quot;: &quot;&quot;,
    &quot;version&quot;: null
  },
  &quot;requests&quot;: {
    &quot;version&quot;: &quot;2.27.0&quot;
  },
  &quot;system_ssl&quot;: {
    &quot;version&quot;: &quot;20000000&quot;
  },
  &quot;urllib3&quot;: {
    &quot;version&quot;: &quot;1.26.7&quot;
  },
  &quot;using_charset_normalizer&quot;: true,
  &quot;using_pyopenssl&quot;: false
}"><pre class="notranslate">{
  <span class="pl-ent">"chardet"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-c1">null</span>
  },
  <span class="pl-ent">"charset_normalizer"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>2.0.10<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"cryptography"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"idna"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.3<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"implementation"</span>: {
    <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>CPython<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.8.2<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"platform"</span>: {
    <span class="pl-ent">"release"</span>: <span class="pl-s"><span class="pl-pds">"</span>21.1.0<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"system"</span>: <span class="pl-s"><span class="pl-pds">"</span>Darwin<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"pyOpenSSL"</span>: {
    <span class="pl-ent">"openssl_version"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
    <span class="pl-ent">"version"</span>: <span class="pl-c1">null</span>
  },
  <span class="pl-ent">"requests"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>2.27.0<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"system_ssl"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>20000000<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"urllib3"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.26.7<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"using_charset_normalizer"</span>: <span class="pl-c1">true</span>,
  <span class="pl-ent">"using_pyopenssl"</span>: <span class="pl-c1">false</span>
}</pre></div>
<p dir="auto">When using proxies in python 3.8.12, I get an error 407. Using any other version of python works fine. I am assuming it could be to do with this <a href="https://docs.python.org/3/whatsnew/3.8.html#notable-changes-in-python-3-8-12" rel="nofollow">https://docs.python.org/3/whatsnew/3.8.html#notable-changes-in-python-3-8-12</a>.</p>

<p dir="auto">I should get a status of 200.</p>

<p dir="auto">I get a status code of 407.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import requests


r = requests.get('https://example.org/', proxies=proxies) # You will need a proxy to test with, I am using a paid service.
print(r.status_code)
"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">requests</span>


<span class="pl-s1">r</span> <span class="pl-c1">=</span> <span class="pl-s1">requests</span>.<span class="pl-en">get</span>(<span class="pl-s">'https://example.org/'</span>, <span class="pl-s1">proxies</span><span class="pl-c1">=</span><span class="pl-s1">proxies</span>) <span class="pl-c"># You will need a proxy to test with, I am using a paid service.</span>
<span class="pl-en">print</span>(<span class="pl-s1">r</span>.<span class="pl-s1">status_code</span>)</pre></div>
<h2 dir="auto">System Information</h2>
<div class="highlight highlight-source-json notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="{
  &quot;chardet&quot;: {
    &quot;version&quot;: null
  },
  &quot;charset_normalizer&quot;: {
    &quot;version&quot;: &quot;2.0.9&quot;
  },
  &quot;cryptography&quot;: {
    &quot;version&quot;: &quot;&quot;
  },
  &quot;idna&quot;: {
    &quot;version&quot;: &quot;3.3&quot;
  },
  &quot;implementation&quot;: {
    &quot;name&quot;: &quot;CPython&quot;,
    &quot;version&quot;: &quot;3.8.12&quot;
  },
  &quot;platform&quot;: {
    &quot;release&quot;: &quot;5.13.0-7620-generic&quot;,
    &quot;system&quot;: &quot;Linux&quot;
  },
  &quot;pyOpenSSL&quot;: {
    &quot;openssl_version&quot;: &quot;&quot;,
    &quot;version&quot;: null
  },
  &quot;requests&quot;: {
    &quot;version&quot;: &quot;2.27.0&quot;
  },
  &quot;system_ssl&quot;: {
    &quot;version&quot;: &quot;101010cf&quot;
  },
  &quot;urllib3&quot;: {
    &quot;version&quot;: &quot;1.26.7&quot;
  },
  &quot;using_charset_normalizer&quot;: true,
  &quot;using_pyopenssl&quot;: false
}"><pre class="notranslate">{
  <span class="pl-ent">"chardet"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-c1">null</span>
  },
  <span class="pl-ent">"charset_normalizer"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>2.0.9<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"cryptography"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"idna"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.3<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"implementation"</span>: {
    <span class="pl-ent">"name"</span>: <span class="pl-s"><span class="pl-pds">"</span>CPython<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>3.8.12<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"platform"</span>: {
    <span class="pl-ent">"release"</span>: <span class="pl-s"><span class="pl-pds">"</span>5.13.0-7620-generic<span class="pl-pds">"</span></span>,
    <span class="pl-ent">"system"</span>: <span class="pl-s"><span class="pl-pds">"</span>Linux<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"pyOpenSSL"</span>: {
    <span class="pl-ent">"openssl_version"</span>: <span class="pl-s"><span class="pl-pds">"</span><span class="pl-pds">"</span></span>,
    <span class="pl-ent">"version"</span>: <span class="pl-c1">null</span>
  },
  <span class="pl-ent">"requests"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>2.27.0<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"system_ssl"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>101010cf<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"urllib3"</span>: {
    <span class="pl-ent">"version"</span>: <span class="pl-s"><span class="pl-pds">"</span>1.26.7<span class="pl-pds">"</span></span>
  },
  <span class="pl-ent">"using_charset_normalizer"</span>: <span class="pl-c1">true</span>,
  <span class="pl-ent">"using_pyopenssl"</span>: <span class="pl-c1">false</span>
}</pre></div>