title: pycurl and SSL cert
body: <p>I am trying to write a pycurl script to access a secured site (HTTPS).</p>
  
  <pre><code>c = pycurl.Curl()
  c.setopt(pycurl.USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20100101 Firefox/8.0')
  c.setopt(pycurl.URL, 'https://for-example-securedsite')
  c.setopt(pycurl.COOKIEFILE, 'cookie.txt')
  c.setopt(pycurl.COOKIEJAR, 'cookies.txt')
  c.setopt(pycurl.WRITEDATA, file("page.html","wb"))   
  </code></pre>
  
  <p>I am getting the below error..</p>
  
  <p>pycurl.error: (60, 'SSL certificate problem, verify that the CA cert is OK. Details:\nerror:14090086:SSL routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed')</p>
  
  <p>The code failed, as it failed to get the SSL cert. </p>
  
  <p>The error went away if I add the below lines to my code.</p>
  
  <pre><code>c.setopt(pycurl.SSL_VERIFYPEER, 0)   
  c.setopt(pycurl.SSL_VERIFYHOST, 0)
  </code></pre>
  
  <p>The above code will skip the certificate verification. But its subjected to 'man in middle' attack.</p>
  
  <p>I know I have the SSL certificate in my local certificate store. Do anyone know how to export my certificate and use it my code.. Some sample codes will be awesome..</p>
  
  <p>Thanks for your time!</p>