Home:ALL Converter>Solving certificate errors when uploading to artifactory with twine in corporate environment

Solving certificate errors when uploading to artifactory with twine in corporate environment

Ask Time:2022-12-20T16:13:36         Author:Itération 122442

Json Formatter

I want to upload a Python package to a secured (HTTPS) Artifactory server from my machine using Twine.

First, using the following:

twine upload --verbose \
--repository-url https://URL/artifactory/api/pypi/PATH \
--username XX \
--password XX \
dist/*

I get the following error:

requests.exceptions.SSLError: HTTPSConnectionPool(host='URL', port=443): Max retries exceeded with url: /artifactory/api/pypi/PATH (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1108)')))

After a big of digging, I found this little solution. So I downloaded the cert.pem file and provided it to my upload command with:

--cert ../../bin/cert.pem

Which still gives me the following error:

certificate verify failed: unable to get local issuer certificate 

How can I solve this issue correctly (I would like NOT TO disable SSL check).

Author:Itération 122442,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/74860141/solving-certificate-errors-when-uploading-to-artifactory-with-twine-in-corporate
Yuvarajan :

It appears to be an issue with the client in recognizing the certificate. Are you trying to execute the above mentioned task in a MacOS machine? If yes, installing Certificates.command should help resolving this issue.\nHow?\nGo to the Applications folder in the system, select the appropriate Python installation directory and double click on Certificates.command file.",
2022-12-20T08:34:14
yy