Skip to content

update_cbo.py SSL handshake failure #6

@bristowrichards

Description

@bristowrichards

When running updatecbo.py, I am getting a persistent Winsock 10054 error and having the connection reset or denied by the host at CBO's website.

Steps to reproduce:

  1. follow instructions for taxdata repo install
  2. install openpyxl
    1. Runconda install -c anaconda openpyxl.
    2. As of 2023-10-19, this updates ca-certificates: 2023.7.2~ --> ca-certificates-2023.08.22-haa95532_0
    3. As of 2023-10-19, this updates openssl: 3.1.2-hcfcfb64_0 --> 3.1.3-hcfcfb64_0
  3. run updatecbo.py

Result:

Updating CBO Economic Projections
Traceback (most recent call last):
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\urllib\request.py", line 1348, in do_open
    h.request(req.get_method(), req.selector, req.data, headers,
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\http\client.py", line 1286, in request
    self._send_request(method, url, body, headers, encode_chunked)
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\http\client.py", line 1332, in _send_request        
    self.endheaders(body, encode_chunked=encode_chunked)
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\http\client.py", line 1281, in endheaders
    self._send_output(message_body, encode_chunked=encode_chunked)
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\http\client.py", line 1041, in _send_output
    self.send(msg)
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\http\client.py", line 979, in send
    self.connect()
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\http\client.py", line 1458, in connect
    self.sock = self._context.wrap_socket(self.sock,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\ssl.py", line 517, in wrap_socket
    return self.sslsocket_class._create(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\ssl.py", line 1108, in _create
    self.do_handshake()
  File "C:\Users\brist\anaconda3\envs\taxdata-dev\Lib\ssl.py", line 1379, 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:
...

(Truncated to remove other 10054 issues that also arise, it's all the same thing.)

Potential fixes:

  1. Installing older versions of openpyxl, or downgrading the two libraries that that installation updates
  2. Upgrade or downgrade requests or urllib3
  3. Alter arguments to the GET request, including headers
  4. Alter other parameters such as adding sleep increments to requests to not get a denial due to spam/ddos suspicions
  5. Using Selenium or bs4 instead of requests_html for handling web sessions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions