<p>I'm trying to request data from endpoints, I can do that with <code>curl -k --key a-key.pem --cert a.pem https://&lt;endpoint&gt;</code></p>
<p>But when I using python3 to do that, I failed every time</p>
<p>Examples:</p>
<p>With curl:</p>
<pre><code>root@control-plane-0:~# curl -k --key /etc/kubernetes/a-key.pem --cert /etc/kubernetes/a.pem https://127.0.0.1:6443/api/
{
  &quot;kind&quot;: &quot;APIVersions&quot;,
  &quot;versions&quot;: [
    &quot;v1&quot;
  ],
  &quot;serverAddressByClientCIDRs&quot;: [
    {
      &quot;clientCIDR&quot;: &quot;0.0.0.0/0&quot;,
      &quot;serverAddress&quot;: &quot;10.0.31.2:6443&quot;
    }
  ]
}
</code></pre>
<p>With python:
(code):</p>
<pre><code>from flask import Flask, render_template
import requests
from ast import literal_eval



app = Flask(__name__)


@app.route('/metrics')
def metrics():
   data = requests.get(&quot;https://127.0.0.1:6443/api/, cert=('/etc/kubernetes/a.pem', '/etc/kubernetes/a-key.pem'))

   print(data)
   return data

if __name__ == '__main__':
   app.run(host='0.0.0.0',port=&quot;5001&quot;, debug=True)
</code></pre>
<p>Result:</p>
<pre><code>    r = adapter.send(request, **kwargs)
  File &quot;/usr/local/lib/python3.9/site-packages/requests/adapters.py&quot;, line 514, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='127.0.0.1', port=6443): Max retries exceeded with url: / (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1121)')))
</code></pre>
<p>Are there any problems with requests libs ?
I can't find a way to make it work</p>
<pre><code></code></pre>

Lê Minh Quân
<p>Have you got your certificates verified  using</p>
<pre><code>openssl verify -CAfile your-cert.pm
</code></pre>
<p>I got the same Problem and solved by using full-chain certificates.please see your certificate contains fullchain(root,intermediate).
And you can try like</p>
<pre><code>import requests
test=request.get(&quot;url&quot;,verify=&quot;certificate-with-path&quot;)
</code></pre>
