<p dir="auto">after upgarde to 2.12.3 under win10, below issue is encountered, any suggestion?<br>
File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\sessions.py", line 535, in post<br>
return self.request('POST', url, data=data, json=json, **kwargs)</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\sessions.py", line 488, in request<br>
resp = self.send(prep, **send_kwargs)</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\sessions.py", line 609, in send<br>
r = adapter.send(request, **kwargs)</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\adapters.py", line 423, in send<br>
timeout=timeout</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\packages\urllib3\connectionpool.py", line 594, in urlopen<br>
chunked=chunked)</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\packages\urllib3\connectionpool.py", line 350, in _make_request<br>
self._validate_conn(conn)</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\packages\urllib3\connectionpool.py", line 835, in _validate_conn<br>
conn.connect()</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\packages\urllib3\connection.py", line 330, in connect<br>
cert = self.sock.getpeercert()</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\packages\urllib3\contrib\pyopenssl.py", line 324, in getpeercert<br>
'subjectAltName': get_subj_alt_name(x509)</p>
<p dir="auto">File "d:\Anaconda3\lib\site-packages\requests-2.12.3-py3.5.egg\requests\packages\urllib3\contrib\pyopenssl.py", line 171, in get_subj_alt_name<br>
ext = cert.extensions.get_extension_for_class(</p>
<p dir="auto">AttributeError: 'Extensions' object has no attribute 'get_extension_for_class'</p>
<p dir="auto">This occurred after I upgraded form 2.11.1 to 2.12.1. The error occurs arbitrarily for the URLs I tried.</p>
<blockquote>
<p dir="auto">requests.get('<a href="http://google.com" rel="nofollow">http://google.com</a>') # works<br>
requests.get('<a href="http://www.google.com" rel="nofollow">http://www.google.com</a>') # works<br>
requests.get('<a href="https://google.com" rel="nofollow">https://google.com</a>') # does not work<br>
requests.get('<a href="https://www.google.com" rel="nofollow">https://www.google.com</a>') # does not work<br>
requests.get('<a href="http://amazon.com" rel="nofollow">http://amazon.com</a>') # sometimes works<br>
requests.get('<a href="http://www.amazon.com" rel="nofollow">http://www.amazon.com</a>') # does not work<br>
requests.get('<a href="https://amazon.com" rel="nofollow">https://amazon.com</a>') # does not work<br>
requests.get('<a href="https://www.amazon.com" rel="nofollow">https://www.amazon.com</a>') # does not work</p>
</blockquote>
<p dir="auto">Below is the error:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.pyc in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
    348         # Trigger any extra validation we need to do.
    349         try:
--&gt; 350             self._validate_conn(conn)
    351         except (SocketTimeout, BaseSSLError) as e:
    352             # Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.pyc in _validate_conn(self, conn)
    833         # Force connect early to allow us to validate the connection.
    834         if not getattr(conn, 'sock', None):  # AppEngine might not have  `.sock`
--&gt; 835             conn.connect()
    836 
    837         if not conn.is_verified:

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/connection.pyc in connect(self)
    328         elif context.verify_mode != ssl.CERT_NONE \
    329                 and self.assert_hostname is not False:
--&gt; 330             cert = self.sock.getpeercert()
    331             if not cert.get('subjectAltName', ()):
    332                 warnings.warn((

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.pyc in getpeercert(self, binary_form)
    322                 (('commonName', x509.get_subject().CN),),
    323             ),
--&gt; 324             'subjectAltName': get_subj_alt_name(x509)
    325         }
    326 

/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.pyc in get_subj_alt_name(peer_cert)
    169     # faster than looping in Python)
    170     try:
--&gt; 171         ext = cert.extensions.get_extension_for_class(
    172             x509.SubjectAlternativeName
    173         ).value

AttributeError: 'Extensions' object has no attribute 'get_extension_for_class'"><pre class="notranslate"><span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">urllib3</span><span class="pl-c1">/</span><span class="pl-s1">connectionpool</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_make_request</span>(<span class="pl-s1">self</span>, <span class="pl-s1">conn</span>, <span class="pl-s1">method</span>, <span class="pl-s1">url</span>, <span class="pl-s1">timeout</span>, <span class="pl-s1">chunked</span>, <span class="pl-c1">**</span><span class="pl-s1">httplib_request_kw</span>)
    <span class="pl-c1">348</span>         <span class="pl-c"># Trigger any extra validation we need to do.</span>
    <span class="pl-c1">349</span>         <span class="pl-k">try</span>:
<span class="pl-c1">-</span><span class="pl-c1">-&gt;</span> <span class="pl-c1">350</span>             <span class="pl-s1">self</span>.<span class="pl-en">_validate_conn</span>(<span class="pl-s1">conn</span>)
    <span class="pl-c1">351</span>         <span class="pl-k">except</span> (<span class="pl-v">SocketTimeout</span>, <span class="pl-v">BaseSSLError</span>) <span class="pl-k">as</span> <span class="pl-s1">e</span>:
    <span class="pl-c1">352</span>             <span class="pl-c"># Py2 raises this as a BaseSSLError, Py3 raises it as socket timeout.</span>

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">urllib3</span><span class="pl-c1">/</span><span class="pl-s1">connectionpool</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">_validate_conn</span>(<span class="pl-s1">self</span>, <span class="pl-s1">conn</span>)
    <span class="pl-c1">833</span>         <span class="pl-c"># Force connect early to allow us to validate the connection.</span>
    <span class="pl-c1">834</span>         <span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-en">getattr</span>(<span class="pl-s1">conn</span>, <span class="pl-s">'sock'</span>, <span class="pl-c1">None</span>):  <span class="pl-c"># AppEngine might not have  `.sock`</span>
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">835</span>             <span class="pl-s1">conn</span>.<span class="pl-en">connect</span>()
    <span class="pl-c1">836</span> 
    <span class="pl-c1">837</span>         <span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">conn</span>.<span class="pl-s1">is_verified</span>:

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">urllib3</span><span class="pl-c1">/</span><span class="pl-s1">connection</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">connect</span>(<span class="pl-s1">self</span>)
    <span class="pl-c1">328</span>         <span class="pl-s1">elif</span> <span class="pl-s1">context</span>.<span class="pl-s1">verify_mode</span> <span class="pl-c1">!=</span> <span class="pl-s1">ssl</span>.<span class="pl-v">CERT_NONE</span> \
    <span class="pl-c1">329</span>                 <span class="pl-c1">and</span> <span class="pl-s1">self</span>.<span class="pl-s1">assert_hostname</span> <span class="pl-c1">is</span> <span class="pl-c1">not</span> <span class="pl-c1">False</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">330</span>             <span class="pl-s1">cert</span> <span class="pl-c1">=</span> <span class="pl-s1">self</span>.<span class="pl-s1">sock</span>.<span class="pl-en">getpeercert</span>()
    <span class="pl-c1">331</span>             <span class="pl-k">if</span> <span class="pl-c1">not</span> <span class="pl-s1">cert</span>.<span class="pl-en">get</span>(<span class="pl-s">'subjectAltName'</span>, ()):
    <span class="pl-c1">332</span>                 <span class="pl-s1">warnings</span>.<span class="pl-s1">warn</span>((

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">urllib3</span><span class="pl-c1">/</span><span class="pl-s1">contrib</span><span class="pl-c1">/</span><span class="pl-s1">pyopenssl</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">getpeercert</span>(<span class="pl-s1">self</span>, <span class="pl-s1">binary_form</span>)
    <span class="pl-c1">322</span>                 ((<span class="pl-s">'commonName'</span>, <span class="pl-s1">x509</span>.<span class="pl-en">get_subject</span>().<span class="pl-v">CN</span>),),
    <span class="pl-c1">323</span>             ),
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">324</span>             <span class="pl-s">'subjectAltName'</span>: <span class="pl-en">get_subj_alt_name</span>(<span class="pl-s1">x509</span>)
    <span class="pl-c1">325</span>         }
    <span class="pl-c1">326</span> 

<span class="pl-c1">/</span><span class="pl-s1">usr</span><span class="pl-c1">/</span><span class="pl-s1">local</span><span class="pl-c1">/</span><span class="pl-s1">lib</span><span class="pl-c1">/</span><span class="pl-s1">python2</span>.<span class="pl-c1">7</span><span class="pl-c1">/</span><span class="pl-s1">dist</span><span class="pl-c1">-</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">requests</span><span class="pl-c1">/</span><span class="pl-s1">packages</span><span class="pl-c1">/</span><span class="pl-s1">urllib3</span><span class="pl-c1">/</span><span class="pl-s1">contrib</span><span class="pl-c1">/</span><span class="pl-s1">pyopenssl</span>.<span class="pl-s1">pyc</span> <span class="pl-c1">in</span> <span class="pl-en">get_subj_alt_name</span>(<span class="pl-s1">peer_cert</span>)
    <span class="pl-c1">169</span>     <span class="pl-c"># faster than looping in Python)</span>
    <span class="pl-c1">170</span>     <span class="pl-s1">try</span>:
<span class="pl-c1">-</span><span class="pl-c1">-</span><span class="pl-c1">&gt;</span> <span class="pl-c1">171</span>         <span class="pl-s1">ext</span> <span class="pl-c1">=</span> <span class="pl-s1">cert</span>.<span class="pl-s1">extensions</span>.<span class="pl-en">get_extension_for_class</span>(
    <span class="pl-c1">172</span>             <span class="pl-s1">x509</span>.<span class="pl-v">SubjectAlternativeName</span>
    <span class="pl-c1">173</span>         ).<span class="pl-s1">value</span>

<span class="pl-v">AttributeError</span>: <span class="pl-s">'Extensions'</span> <span class="pl-s1">object</span> <span class="pl-s1">has</span> <span class="pl-s1">no</span> <span class="pl-s1">attribute</span> <span class="pl-s">'get_extension_for_class'</span></pre></div>
<p dir="auto">Tried it on Ubuntu/Python 2.7.10 and macOS/Python 2.7.11. I have OpenSSL 1.0.2 for both. Same error on both.</p>