5

When I tried to push a new package to my company's artifactory :

python -m twine upload --repository-url https:///artifactory/api/pypi/gdp_pypi dist/*

I got an error on SSL. ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:841)

Any way to disable the SSL verification?

Oceania Water
  • 267
  • 2
  • 11
  • 1
    Why not fix the error instead? – Alejandro Jun 01 '21 at 20:50
  • 1
    Yes you are right, I just point the variable REQUESTS_CA_BUNDLE to my certificate and it worked. – Oceania Water Jun 02 '21 at 13:38
  • Does this answer your question? [Disable Python requests SSL validation for an imported module](https://stackoverflow.com/questions/48391750/disable-python-requests-ssl-validation-for-an-imported-module) – miken32 Mar 28 '23 at 19:38

3 Answers3

2

I just tried the solution by another post: Disable Python requests SSL validation for an imported module

Simply setting environment variable CURL_CA_BUNDLE to an empty string did the job!

$ export CURL_CA_BUNDLE=""

Oceania Water
  • 267
  • 2
  • 11
0

The workaround using CURL_CA_BUNDLE described in "Disable Python requests SSL validation for an imported module" doesn't work anymore.

Possible solution is to use separate script which could be named twine-trusted containing the following code:

import twine.__main__


def disable_server_certificate_validation():
    "Allow twine to just trust the hosts"
    twine.repository.Repository.set_certificate_authority = lambda *args, **kwargs: None


def main():
    disable_server_certificate_validation()
    twine.__main__.main()

__name__ == '__main__' and main()

Source: https://github.com/pypa/twine/pull/463#issuecomment-556892003

I.R.
  • 442
  • 1
  • 7
  • 16
0

Setting an empty string as suggested above doesn't seem to work anymore:

$ export CURL_CA_BUNDLE=""

BUT, when I navigated to my organization's Github in the browser (where the cert was installed and working) and downloaded the .crt for the first cert in the chain, then it DID work when setting the variable to that .crt file.

$ export CURL_CA_BUNDLE="/path/to/cert.crt"