Error in Pyscript scrape SSL: DH_KEY_TOO_SMALL

I’ve been using Pyscript for a while now and its been working fine. After the 2022.07 update I am getting a SSL error.

The logs are showing

This error originated from a custom integration.

Logger: custom_components.pyscript.file.rubish.rubbish_day
Source: custom_components/pyscript/eval.py:480
Integration: Pyscript Python scripting (documentation, issues)
First occurred: 3:46:31 pm (1 occurrences)
Last logged: 3:46:31 pm

Exception in <file.rubish.rubbish_day> line 28: raw_html = task.executor(requests.get, url) ^ SSLError: HTTPSConnectionPool(host=‘apps.castlepoint.gov.uk’, port=443): Max retries exceeded with url: / (Caused by SSLError(SSLError(1, ‘[SSL: DH_KEY_TOO_SMALL] dh key too small (_ssl.c:997)’)))

This is part of the pyscript code.

    url ="https://apps.castlepoint.gov.uk"
    raw_html = task.executor(requests.get, url)
    data = BeautifulSoup(raw_html.text, "html.parser")

I have found old threads with similar errors and they mention downgrading the SSL security by changing the CipherString from DEFAULT@SECLEVEL=2 to DEFAULT@SECLEVEL=1 in the /etc/ssl/openssl.cnf file, I have looked into this but cant see any reference to CipherString = DEFAULT@SECLEVEL=2 in the file plus I am not happy with downgrading the security level.

Are there any other options open to try?

1 Like

same issue

same issue here as well

I also have the same problem with multiscrape.
Has anyone here already found a solution to set the downgrade individually for the run of a custom component ?

I’ve not been able to find a solution to this yet, but still looking.