I have been provided with a pem certificate to authenticate with a third party. Authenticating using certificates is a new concept for me.
Inside are two certificates and a private key.
The issuer has advised they do not support SSL verification but use TLS(1.1/1.2).
I have run a script as below:
import requests as req
import json
url = 'https://url.com/call'
certificate_file = "C:/certs/cert.pem"
headers = {"Content-Type": "application/json"}
req_body ={
"network":{
"network_id": 12345
},
"branch":{
"branch_id": 12345,
},
"export_period":{
"start_date_time": "16-11-2021 00:00:00",
"end_date_time": "17-11-2021 00:00:00"
}
}
jsonObject = json.dumps(req_body)
response = req.post(url,headers=headers,params=jsonObject,verify=certificate_file)
I'm getting the following error:
SSLError: HTTPSConnectionPool(host='url.com, port=443): Max retries exceeded with url: /call?%7B%22network%22:%20%7B%22network_id%22:%2012345%7D,%20%22branch%22:%20%7B%22branch_id%22:%2012345%7D,%20%22export_period%22:%20%7B%22start_date_time%22:%20%2216-11-2021%2000:00:00%22,%20%22end_date_time%22:%20%2217-11-2021%2000:00:00%22%7D%7D (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1123)')))
Would appreciate guidance, my gut says I should be doing something specific for TLS hence the SSL error.