Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Ju1
Contributor

Connecting to QlikSense Python API

Hello,

I’m trying to connect Python to QlikSense in order to perform the same operations as the Qlik engine API explorer, but when I try this code:

 

 

import websocket
import ssl
import json
import requests

user_directory = <user_directory>
user_id = <user_id >


header = ['X-Qlik-User: UserDirectory=' + user_directory + '; UserId=' + user_id]

ws = websocket.create_connection("wss://<myserver>/app/", sslopt={"cert_reqs": ssl.CERT_NONE},header=header)

ws.send(json.dumps({
"handle": -1,
"method": "GetDocList",
"params": [],
"outKey": -1,
"id": 1
}))

result = ws.recv()

print(result)

ws.close()

 

 

 

It returns this to me:

{"jsonrpc":"2.0","method":"OnAuthenticationInformation","params":{"loginUri":"https://<myserver>/internal_forms_authentication/?targetId=<ID>","mustAuthenticate":true}}

How can it return the result of my query ?

 

Thanks !

 

 

Labels (1)
1 Reply
atotom93
Contributor

In the message it returned, the property "mustAuthenticate" is set to "true" indicates that you have not yet been correctly authenticated.