title: python requests ('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')
body: <p>I'm trying to connect to a server using a certificate and a private key using the requests module but I'm having issues.</p>
  
  <p>My code:</p>
  
  <pre><code>import requests
  
  s = requests.Session()
  s.cert = (certificate_file, key_file)
  s.headers = {'Content-Type': 'text/xml;charset=UTF-8',
               'Accept-Encoding': 'gzip,deflate'}
  r = s.post(url=url, data=request_body)
  </code></pre>
  
  <p>Error:</p>
  
  <pre><code>Error: [('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')]
  </code></pre>
  
  <p>The weird thing is that the same certificate and key seems to be working with the http.client module</p>
  
  <pre><code>import ssl
  import http.client
  
  request_url = ...
  request_headers = {
      'Content-Type': 'text/xml;charset=UTF-8',
      'Accept-Encoding': 'gzip,deflate',
  }
  request_body = ...
  
  
  context = ssl.SSLContext(ssl.PROTOCOL_SSLv23)
  context.load_cert_chain(certfile=certificate_file, keyfile=key_file)
  
  connection = http.client.HTTPSConnection(host, port=443, context=context)
  
  connection.request(method="POST", url=request_url,
                     headers=request_headers, body=request_body)
  
  response = connection.getresponse()
  </code></pre>
  
  <p>Any ideas or suggestions would be welcome</p>