title: How to make Python use CA certificates from Mac OS TrustStore?
body: <p>I need to use curtom root certificates on the company intranet and loading them in the Mac OS TrustStore (KeyChain) does solve the problem for all browsers and GUI apps.</p>
  
  <p>It seems that it works even with the version of <code>curl</code> that ships with Mac OS X but it <strong>doesn't work with python</strong>, even the version that ships with Mac OS 10.12 Sierra (Python 2.7.10)</p>
  
  <p>Still, it seems that I would be hit by:</p>
  
  <pre><code>urllib2.URLError: &lt;urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)&gt;
  </code></pre>
  
  <h2>How can I solve this?</h2>
  
  <p>Because I encounter this issue in lots and lots of Python tools I would really appreciate if I find a way to avoid it without having to patch them.</p>
  
  <p>Providing the custom CA certificate myself is not an option because I cannot patch tens of Python tools that I use. </p>
  
  <p>Most of the tools are using the <code>requests</code> library but there are a few that are using the native ssl support in Python directly.</p>