Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ckarras22
Partner - Creator
Partner - Creator

Problem connecting to Engine API through Python or HTML

Hello,

Today i upgraded Qlik Sense desktop to the latest edition (3.1.4) after having my existing one expired. We have developed a series of internal tools based on Python that we need to test them as a POC against desktop edition, before we move them to Qlik Sense. We haven't test them against server though.

It is impossible to connect to Engine API through python and/or raw HTML code after the upgrade. Unfortunately i can't revert to the previous version.

A small sample that used to work is like that

>>>>>>>>>>>>>>>CODE START>>>>>>>>>>>>>>>>>>>>>>>>

from websocket import create_connection

import json

data=json.dumps({

                    'jsonrpc': '2.0',

                    'id': 0,

                    'method': 'OpenDoc',

                    'handle': -1,

                    'params': ['test.qvf']

                },

                    sort_keys=True,

                 indent=4,

                 separators=(',', ': '))

ws = create_connection("ws://localhost:4848")

print("Sending req...")

ws.send(data)

print("Sent")

print("Receiving...")

result =  ws.recv()

print("Received '%s'" % result)

#ws.close()


print("press enter")

<<<<<<<<<<<<<<<<<<<<CODE END<<<<<<<<<<<<<<

The exception is like that

exception.jpg

This same exception is raised also when i try to connect through HTML's websockets.

The code is tested in the corporate PC as well in my private one, just to confirm that a possible network issue stops the connection.

Thank you for your help

Chris K.

1 Solution

Accepted Solutions
Alexander_Thor
Employee
Employee

Make sure you connect to ws://localhost:4848/app/

The /app/ part is there so the Broker service knows that it's the engine you are trying to talk to and not some other service

View solution in original post

8 Replies
Alexander_Thor
Employee
Employee

Make sure you connect to ws://localhost:4848/app/

The /app/ part is there so the Broker service knows that it's the engine you are trying to talk to and not some other service

ckarras22
Partner - Creator
Partner - Creator
Author

Alexander thank you so much...it worked!!! Though i don't understand why it was working all the time without the /app/ part. But in any case, your explanation is clear.

BR

Chris K.

Alexander_Thor
Employee
Employee

Pre-3.0 we did not have the broker service so it was the engine service that listened to localhost:4848

However best practice has always been to use the /app/ route as that is also the session route you should use when opening applications.

Would be cool to see what you have built! Sadly we are lacking good python projects right now

ckarras22
Partner - Creator
Partner - Creator
Author

Yes ... this is my feeling, that the best practice of using the /app/ is forced now.

I will prepare a stripped down version of what can be done with python and Engine API, considering data models, connections, objects and children objects, manipulation of handlers etc and post as document here.

BR

Chris K.

Anonymous
Not applicable

Hi Chris,

Have you shared a document or have any code available for python / Engine API? I would appreciate it! I checked on your profile here on community as well as Branch and am not seeing anything posted yet.

Thanks,

Chris

ckarras22
Partner - Creator
Partner - Creator
Author

Hello Chris,

I haven't done something to strip down an example due to heavy workload on other projects. Nevertheless it is in my to do list to share.

BR

Chris K.

Anonymous
Not applicable

Great thanks, I have followed you. If you could put it on Branch that would be excellent. If you're not Branch Slack channel yet, I hope you sign up and perhaps ping me when you submit it. I can help you clean it up or advise on / facilitate the sharing if desired.

Best,

Chris

mayuringale25
Partner - Creator
Partner - Creator

Hii ,

 Can you share the code for connecting qlik engine api using python

Thanks and Regards
Mayur Ingale