macOS / OS X: Getting Python to trust certificates

I recently got a new laptop, and had some issues connecting to hosts I’d been able to connect to on my previous laptop.

After much googling and no luck, I found the following info via brew info openssl :

All I needed was the intermediate certificate to be placed in that directory and run the command for Python to stop giving me Error in request: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) .

Note that this is Python 3.6 installed via homebrew.

It turns out that the site operator only had the leaf certificate installed, but should have bundled the intermediate with it, so it shouldn’t have been my issue; it just turned out to be.

YMMV, but good luck!


Leave a Reply

Your email address will not be published. Required fields are marked *