Python Webapi : certificate verify failed: self signed certificate in certificate chain

  1. I have a python script to pull component metrics
  2. I am iterating over number of components to pull the metrics and dump into a file
  3. API used : /api/measures/component?organization=myorg &component=mycomp&metricKeys=bugs
  4. while it works for first few components and then fails with error
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self 
 signed certificate in certificate chain (_ssl.c:1108)
During handling of the above exception, another exception occurred:

raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host=‘sonarcloud.io’, port=443): Max retries exceeded with url:

I added a delay too but without luck.

could someone advise please.

regards,
hks

Hi @hkstKM,

If your first calls work, then I would expect the following to work, unless there is something wrong like releasing resources. I don’t expect the issue to be SonarCloud specific though and I would look more into the Python script itself.