I'm trying to connect Qlik sense API editor through Python with below code and I'm getting below error.
OS : Mac Pyton version : 3.X
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)
from websocket import create_connection
import ssl
senseHost = "HOST1"
privateKeyPath = "/Users/ABC"
## userDirectory and userId can be found at QMC -> Users
userDirectory, userId = "DIR", "user1"
url = "wss://" + senseHost + ":443/app" # valid
certs = ({"ca_certs": privateKeyPath + "root.pem",
"certfile": privateKeyPath + "client.pem",
"keyfile": privateKeyPath + "client_key.pem",
"cert_reqs": ssl.CERT_REQUIRED,
"server_side": False
})
ssl.match_hostname = lambda cert, hostname: True
ws = create_connection(url, sslopt=certs,
header={'X-Qlik-User: UserDirectory=%s; UserId=%s' % (userDirectory, userId)})
print ("connetced")
session = ws.recv()
print (session)
There is similar question in StackOverFlow but there is no clear answer how it git resolved. Can anyone help here please ?