title: Python Requests with wincertstore
body: <p>I'm trying to connect to my corporate's internal webpages through the requests package, but since python does not use the windows default trusted certificates the connection is denied. I found out that wincertstore can be used to fetch the windows default certificates. But I'm still not sure how to use that along with the my request. Below is the code I have tried so far.............</p>
  
  <pre><code>import requests, socket, atexit, ssl, wincertstore
  from requests.auth import HTTPBasicAuth
  certfile = wincertstore.CertFile()
  certfile.addstore("CA")
  certfile.addstore("ROOT")
  atexit.register(certfile.close)
  ssl_sock = ssl.wrap_socket(s,ca_certs=certfile.name, 
  cert_reqs=ssl.CERT_REQUIRED)
  requests.get(url)
  </code></pre>
  
  <p>I get the following error...................
  <code>requests.exceptions.SSLError: HTTPSConnectionPool(host='myhost', port=443): Max retries exceeded with url: myurl (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),))</code></p>
  
  <p>I am able to use wget on the same url and download the content. </p>
  
  <p><code>wget --no check certificate --user=my username --password=my password URL</code></p>
  
  <p>But I am not interested in downloading the content as I only need to scrape a small portion of the webpage content.</p>
  
  <p>Pythin version = 3.6.5</p>
  
  <p>Wincertstore link - <a href="https://pypi.org/project/wincertstore/" rel="noreferrer">Link</a></p>
  
  <p>Thanks in advance for your help..............</p>