title: SSL bad Handshake Error 10054 "WSAECONNRESET"
body: <p><strong>Notes:</strong></p>
  
  <pre><code>versions
  
  Python 2.7.11 and my requests version is '2.10.0'
  'OpenSSL 1.0.2d 9 Jul 2015'
  Please read the below comment by Martijn Pieters before reproducing 
  </code></pre>
  
  <p>Initially I tried to get pdf from <code>https://www.neco.navy.mil/necoattach/N6945016R0626_2016-06-20__INFO_NAS_Pensacola_Base_Access.docx</code> using code as below</p>
  
  <p><strong>code1:</strong></p>
  
  <pre><code>&gt;&gt;&gt; import requests
  &gt;&gt;&gt; requests.get("https://www.neco.navy.mil/necoattach/N6945016R0626_2016-06-20__INFO_NAS_Pensacola_Base_Access.docx",verify=False)
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\api.py", line 67, in get
      return request('get', url, params=params, **kwargs)
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\api.py", line 53, in request
      return session.request(method=method, url=url, **kwargs)
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\sessions.py", line 468, in request
      resp = self.send(prep, **send_kwargs)
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\sessions.py", line 576, in send
      r = adapter.send(request, **kwargs)
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\adapters.py", line 447, in send
      raise SSLError(e, request=request)
  requests.exceptions.SSLError: ("bad handshake: SysCallError(10054, 'WSAECONNRESE
  T')",)
  </code></pre>
  
  <p>After googling and searching I found that you have use SSL verification and using session with adapters can solve the problem. But I still got error's please find the code and error's below</p>
  
  <p><strong>Code2:</strong> </p>
  
  <pre><code>import requests
  from requests.adapters import HTTPAdapter
  from requests.packages.urllib3.poolmanager import PoolManager
  import ssl
  import traceback
  
  class MyAdapter(HTTPAdapter):
      def init_poolmanager(self, connections, maxsize, block=False):
          self.poolmanager = PoolManager(num_pools=connections,
                                         maxsize=maxsize,
                                         block=block,
                                         ssl_version=ssl.PROTOCOL_TLSv1)
  
  
  s = requests.Session()
  s.mount('https://', MyAdapter())
  print "Mounted    "
  r = s.get("https://www.neco.navy.mil/necoattach/N6945016R0626_2016-06-20__INFO_NAS_Pensacola_Base_Access.docx", stream=True, timeout=120)
  </code></pre>
  
  <p><strong>Error:</strong></p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\sessions.py", line 480, in get
      return self.request('GET', url, **kwargs)
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\sessions.py", line 468, in request
      resp = self.send(prep, **send_kwargs)
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\sessions.py", line 576, in send
      r = adapter.send(request, **kwargs)
    File "C:\Users\mob140003207\AppData\Local\Enthought\Canopy\User\lib\site-packa
  ges\requests\adapters.py", line 447, in send
      raise SSLError(e, request=request)
  requests.exceptions.SSLError: ("bad handshake: SysCallError(10054, 'WSAECONNRESET')",)
  </code></pre>