Python certificate verify failed

Solved! Go to solution
mkreder
Regular Visitor

Python certificate verify failed

Hi,

 

I got the sample python code from the API doc page. I am trying this code which is in the README.md

 

config.username = 'IJE1SG1HLQL1T5AKRDI721IQli.................'
config.password = 'CXx6XSnm76A........
config.cert_file = 'PATH/cert.pem' # this file is the one I downloaded in the Credentials page next to my user credential
config.key_file = 'PATH//key.pem' # this file is the one it ask me to download when I created the project
config.ssl_ca_cert = 'PATH/ca.crt' # this file is one of the "common files". I tried the Digicert CA file and the VDPCA files and none of them worked.

 

When I try to run the python code I am getting this error if I use the VDPCA cert:

 

2019-01-17 17:56:05,882 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /visadirect/fundstransfer/v1/multipullfundstransactions/status_identifier_example
2019-01-17 17:56:05,924 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /visadirect/fundstransfer/v1/multipullfundstransactions/status_identifier_example
2019-01-17 17:56:05,979 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:726)'),)': /visadirect/fundstransfer/v1/multipullfundstransactions/status_identifier_example

And this error if I use the Digicert CA cert:

 

2019-01-17 18:31:33,416 WARNING Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, u'unknown error (_ssl.c:3027)'),)': /visadirect/fundstransfer/v1/multipullfundstransactions/status_identifier_example
2019-01-17 18:31:33,435 WARNING Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, u'unknown error (_ssl.c:3027)'),)': /visadirect/fundstransfer/v1/multipullfundstransactions/status_identifier_example
2019-01-17 18:31:33,457 WARNING Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(0, u'unknown error (_ssl.c:3027)'),)': /visadirect/fundstransfer/v1/multipullfundstransactions/status_identifier_example

 

I am not sure what I am doing wrong. 

6 REPLIES 6
mkreder
Regular Visitor

Re: Python certificate verify failed

I got it working by switch the CA certificate to a plain text .pem  file

ricardo_visa
Community Scholar

Re: Python certificate verify failed

Awesome! Thanks for sharing. 




Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.
sainikanuj
Newbie

Re: Python certificate verify failed

I am still facing the problem even after trying what you have mentioned..

API_Products
Visa Developer Support Specialist

Re: Python certificate verify failed

Hey @sainikanuj,

 

We're happy to help. Please share with us the request, response and error that you're receiving so that we can further investigate the issue. 

 




Thanks,

Diana H.



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.

Wael
Regular Visitor

Re: Python certificate verify failed

thanks for sharing

 

 

import requests

 

user_id = 'IJE1SG1HLQL1T5AKRDI721IQli.................'
password = 'CXx6XSnm76A........'
url = 'https://sandbox.api.visa.com/vdp/helloworld'
headers = { "Accept":"application/json" }
body = {}
r = requests.get(url,
cert = ( 'PATH/cert.pem' , 'PATH//key.pem' ),
headers = headers,
auth = (user_id, password),)

print r.text

 

 

PATH/cert.pem is the one you downloaded in the Credentials page next to my user credential

# PATH//key.pem is the one it ask you to download when I created the project

maraut
Regular Visitor

Re: Python certificate verify failed

I have tried the exact same thing and I am getting error: 

Could not find the TLS certificate file, invalid path: