QGIS: SSLError, A failure in the SSL library occured

Hey,
I had this problem with SSL certificates too.
However, in my case I didn’t actually get any error message, which made it a bit more complicated to figure out what actually was the issue. In the end I figured out that the SSL certificates were the problem because of running an adaptation of the script provided by Kateryna in this post

Python script with error traceback I adapted Kateryna's script to also print the traceback of an error in case it occured:
import traceback
import specklepy
from specklepy.api.client import SpeckleClient
from specklepy.api.credentials import get_local_accounts

query = ""
speckle_accounts = get_local_accounts()
for i, acc in enumerate(speckle_accounts):
    try:
        print(acc)
        print(acc.token)
        speckle_client = SpeckleClient(acc.serverInfo.url, acc.serverInfo.url.startswith("https"))
        speckle_client.authenticate_with_token(token=acc.token)
        streams = speckle_client.stream.search(query)
        for stream in streams:
            print(stream)
        
    except Exception:
        print(traceback.format_exc())
        pass
    
    print("")

print("done")

In order to solve the SSL errors I

  1. Opened the OSGeo4W Shell
  2. Ran pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org pip_system_certs

This installs pip_system_certs, which pip, and I guess Python too, to use the system’s SSL certificates instead of its own bundled ones. This resolved my SSL certificate issues with the QGIS connector.

4 Likes