title: Can I provide a list of acceptable hostnames to an SSLSocket?
body: <p>I'm trying to connect to a server with a self-signed certificate and no domain name. The problem is, despite having loaded a copy of the server's certificate with <code>SSLContext.load_verify_locations()</code>, it seems to consider it invalid:</p>
  
  <pre><code>ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:550)
  </code></pre>
  
  <p>I'm pretty sure it's just a hostname mismatch, because I'm <code>connect()</code>ing to the server's IP, and the certificate doesn't have the IP in the <code>Common Name</code> field. Is there any way to tell the <code>SSLSocket</code> “it's okay if the server's certificate is for one of these hostnames”?</p>