qe-api-client 2.3.0__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/PKG-INFO +12 -2
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_app_api.py +19 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/engine_communicator.py +4 -13
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/structs.py +6 -1
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/PKG-INFO +12 -2
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/SOURCES.txt +3 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/requires.txt +1 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/setup.py +3 -2
- qe_api_client-2.4.0/test/test.py +43 -0
- qe_api_client-2.4.0/test/test_api.py +52 -0
- qe_api_client-2.4.0/test/test_chart_content.py +17 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/LICENSE +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/README.md +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/__init__.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/__init__.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_field_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_dimension_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_measure_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_object_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_variable_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_global_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/engine.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/dependency_links.txt +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client.egg-info/top_level.txt +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/setup.cfg +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/test/test_app_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/test/test_field_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/test/test_global_api.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/test/test_labs.py +0 -0
- {qe_api_client-2.3.0 → qe_api_client-2.4.0}/test/test_pyqlikengine.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: qe-api-client
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.4.0
|
4
4
|
Summary: Python wrapper around Qlik Engine JSON API
|
5
5
|
Home-page: https://github.com/lr-bicc/qe-api-client
|
6
6
|
Author: Rumen Vasilev
|
@@ -12,6 +12,16 @@ Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
License-File: LICENSE
|
14
14
|
Requires-Dist: websocket-client>=0.47.0
|
15
|
+
Requires-Dist: pandas>=2.2.0
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: requires-dist
|
23
|
+
Dynamic: requires-python
|
24
|
+
Dynamic: summary
|
15
25
|
|
16
26
|
# Qlik Engine API Client
|
17
27
|
|
@@ -708,5 +708,24 @@ class EngineAppApi:
|
|
708
708
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
709
709
|
try:
|
710
710
|
return response['result']
|
711
|
+
except KeyError:
|
712
|
+
return response['error']
|
713
|
+
|
714
|
+
def get_variable_by_id(self, doc_handle, variable_id):
|
715
|
+
"""
|
716
|
+
Gets the handle of a variable.
|
717
|
+
|
718
|
+
Parameters:
|
719
|
+
doc_handle (int): The handle identifying the document.
|
720
|
+
variable_id (str): The id of the variable.
|
721
|
+
|
722
|
+
Returns:
|
723
|
+
dict: The handle of the generic variable.
|
724
|
+
"""
|
725
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "GetVariableById",
|
726
|
+
"params": {"qId": variable_id}})
|
727
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
728
|
+
try:
|
729
|
+
return response['result']['qReturn']
|
711
730
|
except KeyError:
|
712
731
|
return response['error']
|
@@ -22,21 +22,12 @@ class EngineCommunicator:
|
|
22
22
|
|
23
23
|
class SecureEngineCommunicator(EngineCommunicator):
|
24
24
|
|
25
|
-
def __init__(self, url, user_directory,
|
26
|
-
user_id, ca_certs, certfile,
|
27
|
-
keyfile, app_id=None
|
28
|
-
):
|
25
|
+
def __init__(self, url, user_directory, user_id, ca_certs, certfile, keyfile, app_id=None):
|
29
26
|
self.url = "wss://" + url + ":4747/app/" + str(app_id)
|
30
|
-
certs = ({"ca_certs": ca_certs,
|
31
|
-
"
|
32
|
-
"keyfile": keyfile,
|
33
|
-
"cert_reqs": ssl.CERT_NONE,
|
34
|
-
"server_side": False
|
35
|
-
})
|
27
|
+
certs = ({"ca_certs": ca_certs, "certfile": certfile, "keyfile": keyfile, "cert_reqs": ssl.CERT_NONE,
|
28
|
+
"server_side": False})
|
36
29
|
|
37
30
|
ssl.match_hostname = lambda cert, hostname: True
|
38
31
|
header = f'X-Qlik-User: UserDirectory={user_directory}; UserId={user_id}' # NOQA
|
39
|
-
self.ws = create_connection(
|
40
|
-
self.url, sslopt=certs,
|
41
|
-
cookie=None, header={header})
|
32
|
+
self.ws = create_connection(self.url, sslopt=certs, cookie=None, header={header})
|
42
33
|
self.session = self.ws.recv()
|
@@ -70,4 +70,9 @@ def generic_measure_properties(info, lb_meas_def, meas_title):
|
|
70
70
|
|
71
71
|
def do_reload_ex_params(mode=0, partial=False, debug=False, reload_id="", skip_store=False, row_limit=0):
|
72
72
|
return {"qMode": mode, "qPartial": partial, "qDebug": debug, "qReloadId": reload_id, "qSkipStore": skip_store,
|
73
|
-
"qRowLimit": row_limit}
|
73
|
+
"qRowLimit": row_limit}
|
74
|
+
|
75
|
+
def dimension_list_def():
|
76
|
+
return {"qInfo": {"qType": "DimensionList"},
|
77
|
+
"qDimensionListDef": {"qType": "dimension",
|
78
|
+
"qData": {"title": "/title", "tags": "/tags", "grouping": "/qDim/qGrouping", "info": "/qDimInfos"}}}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.2
|
2
2
|
Name: qe-api-client
|
3
|
-
Version: 2.
|
3
|
+
Version: 2.4.0
|
4
4
|
Summary: Python wrapper around Qlik Engine JSON API
|
5
5
|
Home-page: https://github.com/lr-bicc/qe-api-client
|
6
6
|
Author: Rumen Vasilev
|
@@ -12,6 +12,16 @@ Requires-Python: >=3.6
|
|
12
12
|
Description-Content-Type: text/markdown
|
13
13
|
License-File: LICENSE
|
14
14
|
Requires-Dist: websocket-client>=0.47.0
|
15
|
+
Requires-Dist: pandas>=2.2.0
|
16
|
+
Dynamic: author
|
17
|
+
Dynamic: author-email
|
18
|
+
Dynamic: classifier
|
19
|
+
Dynamic: description
|
20
|
+
Dynamic: description-content-type
|
21
|
+
Dynamic: home-page
|
22
|
+
Dynamic: requires-dist
|
23
|
+
Dynamic: requires-python
|
24
|
+
Dynamic: summary
|
15
25
|
|
16
26
|
# Qlik Engine API Client
|
17
27
|
|
@@ -18,7 +18,10 @@ qe_api_client/api_classes/engine_generic_measure_api.py
|
|
18
18
|
qe_api_client/api_classes/engine_generic_object_api.py
|
19
19
|
qe_api_client/api_classes/engine_generic_variable_api.py
|
20
20
|
qe_api_client/api_classes/engine_global_api.py
|
21
|
+
test/test.py
|
22
|
+
test/test_api.py
|
21
23
|
test/test_app_api.py
|
24
|
+
test/test_chart_content.py
|
22
25
|
test/test_field_api.py
|
23
26
|
test/test_global_api.py
|
24
27
|
test/test_labs.py
|
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
|
|
5
5
|
|
6
6
|
setuptools.setup(
|
7
7
|
name="qe-api-client",
|
8
|
-
version="2.
|
8
|
+
version="2.4.0",
|
9
9
|
author="Rumen Vasilev",
|
10
10
|
author_email="R.Vasilev@LRWorld.com",
|
11
11
|
description="Python wrapper around Qlik Engine JSON API",
|
@@ -20,7 +20,8 @@ setuptools.setup(
|
|
20
20
|
"Operating System :: OS Independent",
|
21
21
|
],
|
22
22
|
install_requires=[
|
23
|
-
'websocket-client>=0.47.0'
|
23
|
+
'websocket-client>=0.47.0',
|
24
|
+
'pandas>=2.2.0'
|
24
25
|
],
|
25
26
|
python_requires='>=3.6',
|
26
27
|
)
|
@@ -0,0 +1,43 @@
|
|
1
|
+
from qe_api_client.engine import QixEngine
|
2
|
+
import math
|
3
|
+
import pandas as pd
|
4
|
+
|
5
|
+
# url = 'ws://localhost:4848/app'
|
6
|
+
# qixe = QixEngine(url=url)
|
7
|
+
|
8
|
+
url = "lr-analytics-test.lr-netz.local"
|
9
|
+
user_directory = "LR"
|
10
|
+
user_id = "!QlikSense"
|
11
|
+
qlik_certs_path = "C:/LocalUserData/Certificates/Sense TEST"
|
12
|
+
ca_certs = qlik_certs_path + "/root.pem"
|
13
|
+
certfile = qlik_certs_path + "/client.pem"
|
14
|
+
keyfile = qlik_certs_path + "/client_key.pem"
|
15
|
+
qixe = QixEngine(url, user_directory, user_id, ca_certs, certfile, keyfile)
|
16
|
+
|
17
|
+
# App ID holen
|
18
|
+
doc_id = "0c6a91a3-4dc0-490e-ae0f-41391b39c2ec" # Bonus Competitions
|
19
|
+
# doc_id = "f9e79d92-652b-4ba8-8487-84e2825b71c5" # Sales KPI
|
20
|
+
# doc_id = "Test.qvf"
|
21
|
+
|
22
|
+
# App öffnen
|
23
|
+
opened_doc = qixe.ega.open_doc(doc_id)
|
24
|
+
print(opened_doc)
|
25
|
+
|
26
|
+
doc_handle = qixe.get_handle(opened_doc)
|
27
|
+
|
28
|
+
# # Lineage-Daten aus der API holen
|
29
|
+
# lineage = qixe.eaa.get_lineage(doc_handle)
|
30
|
+
# print(lineage)
|
31
|
+
#
|
32
|
+
# # Erstelle den DataFrame und fülle fehlende Werte mit ""
|
33
|
+
# df = pd.DataFrame(lineage) #.fillna("")
|
34
|
+
# df = df[(df["qDiscriminator"].notna()) | (df["qStatement"].notna())].fillna("")
|
35
|
+
# # df = df.reindex(columns=["qDiscriminator", "qStatement"]).fillna("")
|
36
|
+
|
37
|
+
df = qixe.get_app_lineage_info(doc_handle)
|
38
|
+
|
39
|
+
print(df)
|
40
|
+
|
41
|
+
|
42
|
+
# Websocket-Verbindung schließen
|
43
|
+
QixEngine.disconnect(qixe)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from qe_api_client.engine import QixEngine
|
2
|
+
from qe_api_client.structs import field_value
|
3
|
+
|
4
|
+
# url = 'lr-analytics-test.lr-netz.local'
|
5
|
+
# user_directory = 'LR'
|
6
|
+
# user_id = 'r.vasilev'
|
7
|
+
# ca_certs = 'C:\\LocalUserData\\Certificates\\Sense TEST\\root.pem'
|
8
|
+
# certfile = 'C:\\LocalUserData\\Certificates\\Sense TEST\\client.pem'
|
9
|
+
# keyfile = 'C:\\LocalUserData\\Certificates\\Sense TEST\\client_key.pem'
|
10
|
+
# qixe = QixEngine(url=url, user_directory=user_directory, user_id=user_id, ca_certs=ca_certs, certfile=certfile,
|
11
|
+
# keyfile=keyfile)
|
12
|
+
|
13
|
+
url = 'ws://localhost:4848/app'
|
14
|
+
qixe = QixEngine(url)
|
15
|
+
opened_app = qixe.ega.open_doc("Test")
|
16
|
+
# print(opened_app)
|
17
|
+
app_handle = qixe.get_handle(opened_app)
|
18
|
+
# print(app_handle)
|
19
|
+
|
20
|
+
list_of_values = ["A", "C"]
|
21
|
+
|
22
|
+
test = qixe.select_in_dimension(app_handle, "Dim1", ["A", "B"])
|
23
|
+
print(test)
|
24
|
+
|
25
|
+
# field = qixe.eaa.get_field(app_handle, "Dim1")
|
26
|
+
# print(field)
|
27
|
+
#
|
28
|
+
# fld_handle = qixe.get_handle(field)
|
29
|
+
# print(fld_handle)
|
30
|
+
|
31
|
+
# selected_value = qixe.efa.select(field_handle, "B")
|
32
|
+
# print(selected_value)
|
33
|
+
|
34
|
+
# fld_value_1 = qixe.structs.field_value("A")
|
35
|
+
# fld_value_2 = qixe.structs.field_value("C")
|
36
|
+
# selected_values = qixe.efa.select_values(fld_handle, [fld_value_1, fld_value_2])
|
37
|
+
|
38
|
+
# values_to_select = []
|
39
|
+
# for val in list_of_values:
|
40
|
+
# fld_value = qixe.structs.field_value(val)
|
41
|
+
# values_to_select.append(fld_value)
|
42
|
+
# response = qixe.efa.select_values(fld_handle, values_to_select)
|
43
|
+
# print(response)
|
44
|
+
|
45
|
+
df = qixe.get_constructed_table_data(app_handle, [], [],
|
46
|
+
["BjKvssq", "48a5672b-e9b3-4f96-8ff4-480f606e3c14"],
|
47
|
+
["snmpR", "1ad7060c-56ec-46d1-b83a-ff1393e0b236"])
|
48
|
+
|
49
|
+
print(df)
|
50
|
+
|
51
|
+
# Websocket-Verbindung schließen
|
52
|
+
QixEngine.disconnect(qixe)
|
@@ -0,0 +1,17 @@
|
|
1
|
+
from qe_api_client.engine import QixEngine
|
2
|
+
|
3
|
+
url = 'ws://localhost:4848/app'
|
4
|
+
qixe = QixEngine(url=url)
|
5
|
+
|
6
|
+
# App ID holen
|
7
|
+
# doc_id = "f9e79d92-652b-4ba8-8487-84e2825b71c5" # Sales KPI
|
8
|
+
doc_id = "Test.qvf"
|
9
|
+
|
10
|
+
# App öffnen
|
11
|
+
opened_doc = qixe.ega.open_doc(doc_id)
|
12
|
+
# print(opened_doc)
|
13
|
+
|
14
|
+
doc_handle = qixe.get_handle(opened_doc)
|
15
|
+
|
16
|
+
df = qixe.get_chart_data(doc_handle, "tshujdG") # Pivot: wPSYmr | Straight: tshujdG | Bar chart: LapHp | Pie chart: gYyUxS
|
17
|
+
print(df)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_measure_api.py
RENAMED
File without changes
|
{qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_object_api.py
RENAMED
File without changes
|
{qe_api_client-2.3.0 → qe_api_client-2.4.0}/qe_api_client/api_classes/engine_generic_variable_api.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|