-
Re: Qlik Engine API - how to make requests? [Python / Twisted]
Ariel Eidelstein Aug 7, 2017 9:33 AM (in response to Cristian Hainic)Hello Cristian,
Have you managed to solve this issue?
Thanks,
Ariel
-
Re: Qlik Engine API - how to make requests? [Python / Twisted]
Cristian Hainic Aug 7, 2017 9:39 AM (in response to Ariel Eidelstein )Hi Ariel. I quit using Twisted for this. I found that creating apps works fine with Python's aiohttp module and its websocket capabilities.
-
Re: Qlik Engine API - how to make requests? [Python / Twisted]
Ariel Eidelstein Aug 8, 2017 9:34 AM (in response to Cristian Hainic)Hi Cristian,
Does aiohttp accept https connections?
I also kindly ask you if you can share any script for authenticate to Qlik Sense Server or a page where I can look at.
Thanks!
Ariel
-
Re: Qlik Engine API - how to make requests? [Python / Twisted]
Cristian Hainic Oct 23, 2017 1:46 PM (in response to Ariel Eidelstein )Hi Ariel.
Aiohttp also handles HTTPS connections, yes, but here we are addressing the Qlik Engine API, which is a websocket server. So I needed to build a websocket client. There is no code out there on the internet that can walk you through this, unfortunately, especially with Python. But you can read about connecting to the Engine API here: Connecting to the Qlik Engine API ‒ Qlik Sense . Personally I am using Qlik Sense Enterprise and connecting directly using certificates. Below is the Python process I am using.
So what I did for authentication was to use a certificate file (e.g., "client.pem") and a certificate key file (e.g., "key_client.pem"), which my company had generated from the server hosting our Qlik instance. I loaded these two files into the ssl context certification chain (using Python's ssl module) and then created a connection using aiohttp's TCPConnector, passing the ssl context as an argument. Then I created an aiohttp.ClientSession using the aforementioned connection as a connector. Finally, I called the ws_connect() method of the ClientSession, passing as an argument a websocket address formatted as follows: wss://<host>:<port>/app
And the connection was finally made. I could then call the various Engine API methods. I cannot release any code from the project I am working on, but this is the general process for establishing a connection. I found Qlik APIs to be particularly user-UNfriendly, so the best you can do is arm yourself with patience and work it out piece by piece. As you can see, this question was asked in March and I'm still having trouble figuring out how to use the Engine API to its full capabilities.
-
-
-
-
Re: Qlik Engine API - how to make requests? [Python / Twisted]
Siva Sakthi Velan Rajagopal Aug 26, 2017 2:47 AM (in response to Cristian Hainic)Hi Cristian ,
Can you please share the sample code. To connecting Engine API through websocket using Python.
socketOptions = {"ca_certs": "client.pem","keyfile":"client_key.pem", "certfile": "root.pem")}
websocket.enableTrace(True)
ws = websocket.WebSocketApp(wss://localhost/app, on_message= message,on_error =error , on_close = close)
ws.run_forever(sslopt=socketOptions)
It's not connecting anymore ? its show like key_value mismatch..!
But when i check using openssl , both are same ?
what's with wrong in above code ? Can please you help me out in this ?
Thanks in advance ... !
-
Re: Qlik Engine API - how to make requests? [Python / Twisted]
Cristian Hainic Aug 28, 2017 4:31 AM (in response to Siva Sakthi Velan Rajagopal)did it connect before?
-