Python 3.7.7 (OS X) socket SSL Ignore Verification

I was recently working on a script to pull certificate data from remote hosts. While in most cases you should validate SSL certificates, I did not have that requirement.

Many of the examples I found discuss the following strategy:

context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode = ssl.CERT_NONE

This resulted in my terminal returning { }. Helpful.

After me spending some time crying in the corner contemplating my life choices, I realized that the solution was simple:

context = ssl.create_default_context()
context.check_hostname = False
context.verify_mode |= ssl.CERT_NONE

And now I can see some certificate data. What a stupid problem.