<p dir="auto">I'm not super awesome at Python, so I'd appreciate any help you can provide to help nail down this issue.</p>
<p dir="auto">Newer versions of Python 3 on Windows appear to have an issue when doing an ssl handshake. This appears to be a problem with urllib3 on Windows python packages only. I was able to successfully use Python 3.3.2 and 3.2.4 on Ubuntu without this issue.</p>
<p dir="auto">Effected Versions: Windows Python 3.3.x, 3.2.x</p>
<p dir="auto">Works in: Non-Windows Python 3.3.x, 3.2.x, Windows 3.1.x</p>
<p dir="auto">While I'm almost certain here the bug is actually in Python's urllib3 and not Requests, I'm not super experienced, so I feel a little over my head. Of course, this bug effects anyone who uses Requests too. It appears related to this bug: <a href="http://bugs.python.org/issue16361" rel="nofollow">http://bugs.python.org/issue16361</a></p>
<p dir="auto">In order to communicate with the server, I am using Lantern: <a href="https://github.com/dechols/lantern">https://github.com/dechols/lantern</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    v = lantern.AbstractAPI(username, password)
    v.get_app_list()"><pre class="notranslate"><code class="notranslate">    v = lantern.AbstractAPI(username, password)
    v.get_app_list()
</code></pre></div>
<p dir="auto">Which causes the failure.</p>
<p dir="auto">But even using a very simple GET with requests directly, causes the same issue:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="    r = requests.get(url=&quot;https://analysiscenter.veracode.com/api/4.0/getapplist.do&quot;, auth=(username, password))"><pre class="notranslate"><code class="notranslate">    r = requests.get(url="https://analysiscenter.veracode.com/api/4.0/getapplist.do", auth=(username, password))
</code></pre></div>
<p dir="auto">Please help! I'd love to get this fixed, where-ever it might need fixing.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 428, in urlopen
    body=body, headers=headers)
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 280, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 1061, in request
    self._send_request(method, url, body, headers)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 1099, in _send_request
    self.endheaders(body)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 1057, in endheaders
    self._send_output(message_body)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 902, in _send_output
    self.send(msg)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 840, in send
    self.connect()
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 107, in connect
    ssl_version=resolved_ssl_version)
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\util.py&quot;, line 369, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File &quot;C:\Python33\lib\ssl.py&quot;, line 210, in wrap_socket
    _context=self)
  File &quot;C:\Python33\lib\ssl.py&quot;, line 310, in __init__
    raise x
  File &quot;C:\Python33\lib\ssl.py&quot;, line 306, in __init__
    self.do_handshake()
  File &quot;C:\Python33\lib\ssl.py&quot;, line 513, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;C:\Python33\lib\site-packages\requests\adapters.py&quot;, line 292, in send
    timeout=timeout
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 474, in urlopen
    raise MaxRetryError(self, url, e)
[Finished in 61.3s with exit code 1]requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/4.0/getapplist.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;C:\tfs\Vertafore_TFSDev\CQ\veracode\pythontestscriptonation.py&quot;, line 11, in &lt;module&gt;
    r = requests.get(url=&quot;https://analysiscenter.veracode.com/api/4.0/getapplist.do&quot;, auth=(username, password))
  File &quot;C:\Python33\lib\site-packages\requests\api.py&quot;, line 55, in get
    return request('get', url, **kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\api.py&quot;, line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\sessions.py&quot;, line 335, in request
    resp = self.send(prep, **send_kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\sessions.py&quot;, line 438, in send
    r = adapter.send(request, **kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\adapters.py&quot;, line 327, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/4.0/getapplist.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 428, in urlopen
    body=body, headers=headers)
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 280, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Python33\lib\http\client.py", line 1061, in request
    self._send_request(method, url, body, headers)
  File "C:\Python33\lib\http\client.py", line 1099, in _send_request
    self.endheaders(body)
  File "C:\Python33\lib\http\client.py", line 1057, in endheaders
    self._send_output(message_body)
  File "C:\Python33\lib\http\client.py", line 902, in _send_output
    self.send(msg)
  File "C:\Python33\lib\http\client.py", line 840, in send
    self.connect()
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 107, in connect
    ssl_version=resolved_ssl_version)
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\util.py", line 369, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Python33\lib\ssl.py", line 210, in wrap_socket
    _context=self)
  File "C:\Python33\lib\ssl.py", line 310, in __init__
    raise x
  File "C:\Python33\lib\ssl.py", line 306, in __init__
    self.do_handshake()
  File "C:\Python33\lib\ssl.py", line 513, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\requests\adapters.py", line 292, in send
    timeout=timeout
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 474, in urlopen
    raise MaxRetryError(self, url, e)
[Finished in 61.3s with exit code 1]requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/4.0/getapplist.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\tfs\Vertafore_TFSDev\CQ\veracode\pythontestscriptonation.py", line 11, in &lt;module&gt;
    r = requests.get(url="https://analysiscenter.veracode.com/api/4.0/getapplist.do", auth=(username, password))
  File "C:\Python33\lib\site-packages\requests\api.py", line 55, in get
    return request('get', url, **kwargs)
  File "C:\Python33\lib\site-packages\requests\api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python33\lib\site-packages\requests\sessions.py", line 335, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python33\lib\site-packages\requests\sessions.py", line 438, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python33\lib\site-packages\requests\adapters.py", line 327, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/4.0/getapplist.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)
</code></pre></div>
<p dir="auto">I'm getting a strange error when using Requests in Python 3.3 (other flavors of Python  3 do not get this error):</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Traceback (most recent call last):
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 421, in urlopen
    body=body, headers=headers)
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 273, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 1049, in request
    self._send_request(method, url, body, headers)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 1087, in _send_request
    self.endheaders(body)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 1045, in endheaders
    self._send_output(message_body)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 890, in _send_output
    self.send(msg)
  File &quot;C:\Python33\lib\http\client.py&quot;, line 828, in send
    self.connect()
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 104, in connect
    ssl_version=resolved_ssl_version)
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\util.py&quot;, line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File &quot;C:\Python33\lib\ssl.py&quot;, line 210, in wrap_socket
    _context=self)
  File &quot;C:\Python33\lib\ssl.py&quot;, line 310, in __init__
    raise x
  File &quot;C:\Python33\lib\ssl.py&quot;, line 306, in __init__
    self.do_handshake()
  File &quot;C:\Python33\lib\ssl.py&quot;, line 513, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;C:\Python33\lib\site-packages\requests\adapters.py&quot;, line 211, in send
    timeout=timeout
  File &quot;C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py&quot;, line 465, in urlopen
    raise MaxRetryError(self, url, e)
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/2.0/getappbuilds.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File &quot;C:\tfs\Vertafore_TFSDev\CQ\python\veracode\pythontestscriptonation.py&quot;, line 33, in &lt;module&gt;
    print(v.get_app_builds())
  File &quot;C:\tfs\Vertafore_TFSDev\CQ\python\veracode\apiwrapper.py&quot;, line 184, in get_app_builds
    {}
  File &quot;C:\tfs\Vertafore_TFSDev\CQ\python\veracode\apiwrapper.py&quot;, line 57, in request
    r = requests.get(URL, params=data, auth=username_password)
  File &quot;C:\Python33\lib\site-packages\requests\api.py&quot;, line 55, in get
    return request('get', url, **kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\api.py&quot;, line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\sessions.py&quot;, line 354, in request
    resp = self.send(prep, **send_kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\sessions.py&quot;, line 460, in send
    r = adapter.send(request, **kwargs)
  File &quot;C:\Python33\lib\site-packages\requests\adapters.py&quot;, line 246, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/2.0/getappbuilds.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)
[Finished in 61.0s with exit code 1]"><pre class="notranslate"><code class="notranslate">Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 421, in urlopen
    body=body, headers=headers)
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 273, in _make_request
    conn.request(method, url, **httplib_request_kw)
  File "C:\Python33\lib\http\client.py", line 1049, in request
    self._send_request(method, url, body, headers)
  File "C:\Python33\lib\http\client.py", line 1087, in _send_request
    self.endheaders(body)
  File "C:\Python33\lib\http\client.py", line 1045, in endheaders
    self._send_output(message_body)
  File "C:\Python33\lib\http\client.py", line 890, in _send_output
    self.send(msg)
  File "C:\Python33\lib\http\client.py", line 828, in send
    self.connect()
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 104, in connect
    ssl_version=resolved_ssl_version)
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\util.py", line 329, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Python33\lib\ssl.py", line 210, in wrap_socket
    _context=self)
  File "C:\Python33\lib\ssl.py", line 310, in __init__
    raise x
  File "C:\Python33\lib\ssl.py", line 306, in __init__
    self.do_handshake()
  File "C:\Python33\lib\ssl.py", line 513, in do_handshake
    self._sslobj.do_handshake()
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Python33\lib\site-packages\requests\adapters.py", line 211, in send
    timeout=timeout
  File "C:\Python33\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 465, in urlopen
    raise MaxRetryError(self, url, e)
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/2.0/getappbuilds.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\tfs\Vertafore_TFSDev\CQ\python\veracode\pythontestscriptonation.py", line 33, in &lt;module&gt;
    print(v.get_app_builds())
  File "C:\tfs\Vertafore_TFSDev\CQ\python\veracode\apiwrapper.py", line 184, in get_app_builds
    {}
  File "C:\tfs\Vertafore_TFSDev\CQ\python\veracode\apiwrapper.py", line 57, in request
    r = requests.get(URL, params=data, auth=username_password)
  File "C:\Python33\lib\site-packages\requests\api.py", line 55, in get
    return request('get', url, **kwargs)
  File "C:\Python33\lib\site-packages\requests\api.py", line 44, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Python33\lib\site-packages\requests\sessions.py", line 354, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Python33\lib\site-packages\requests\sessions.py", line 460, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python33\lib\site-packages\requests\adapters.py", line 246, in send
    raise ConnectionError(e)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='analysiscenter.veracode.com', port=443): Max retries exceeded with url: /api/2.0/getappbuilds.do (Caused by &lt;class 'ConnectionResetError'&gt;: [WinError 10054] An existing connection was forcibly closed by the remote host)
[Finished in 61.0s with exit code 1]
</code></pre></div>
<p dir="auto">This automation has run for months on Python 3.2 and these errors have never occurred. I don't really know enough about requests to investigate this issue, but I'd be happy to help recreate the issue or debug if someone else can. Perhaps there's a bug in how Requests is handling HTTPS requests with Python 3.3? (Did 3.3 change how urllib works?...I don't know offhand...)</p>
<p dir="auto">Again, I'm not getting any of these issues in Python 3.2 or Python 3.1. Please help! :)</p>