qe-api-client 2.0.0__tar.gz → 2.2.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.0.0 → qe_api_client-2.2.0}/PKG-INFO +1 -1
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_app_api.py +27 -56
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_field_api.py +32 -22
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_generic_object_api.py +25 -8
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_global_api.py +2 -1
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/engine.py +134 -102
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/engine_helper.py +10 -10
- qe_api_client-2.2.0/qe_api_client/structs.py +69 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client.egg-info/PKG-INFO +1 -1
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/setup.py +2 -2
- qe_api_client-2.2.0/test/test_app_api.py +81 -0
- qe_api_client-2.2.0/test/test_field_api.py +60 -0
- qe_api_client-2.2.0/test/test_pyqlikengine.py +62 -0
- qe_api_client-2.0.0/qe_api_client/structs.py +0 -81
- qe_api_client-2.0.0/test/test_app_api.py +0 -102
- qe_api_client-2.0.0/test/test_field_api.py +0 -71
- qe_api_client-2.0.0/test/test_pyqlikengine.py +0 -74
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/LICENSE +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/README.md +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/__init__.py +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/__init__.py +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_generic_dimension_api.py +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_generic_measure_api.py +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_generic_variable_api.py +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/engine_communicator.py +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client.egg-info/SOURCES.txt +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client.egg-info/dependency_links.txt +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client.egg-info/requires.txt +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client.egg-info/top_level.txt +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/setup.cfg +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/test/test_global_api.py +0 -0
- {qe_api_client-2.0.0 → qe_api_client-2.2.0}/test/test_labs.py +0 -0
@@ -141,10 +141,10 @@ class EngineAppApi:
|
|
141
141
|
Parameters:
|
142
142
|
doc_handle (int): The handle identifying the app document.
|
143
143
|
field_name (str): The name of the field to retrieve.
|
144
|
-
state_name (str): The name of the state. Default is
|
144
|
+
state_name (str): The name of the alternate state. Default state is current selections.
|
145
145
|
|
146
146
|
Returns:
|
147
|
-
dict:
|
147
|
+
dict: Object interface.
|
148
148
|
"""
|
149
149
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "GetField",
|
150
150
|
"params": {"qFieldName": field_name, "qStateName": state_name}})
|
@@ -154,22 +154,19 @@ class EngineAppApi:
|
|
154
154
|
except KeyError:
|
155
155
|
return response['error']
|
156
156
|
|
157
|
-
def create_object(self, doc_handle,
|
157
|
+
def create_object(self, doc_handle, prop):
|
158
158
|
"""
|
159
159
|
Creates a new object in the app identified by the document handle.
|
160
160
|
|
161
161
|
Parameters:
|
162
162
|
doc_handle (int): The handle identifying the app document.
|
163
|
-
|
164
|
-
q_type (str): The type of the new object. Default is "ListObject".
|
165
|
-
struct_name (str): The name of the structure defining the object. Default is "qListObjectDef".
|
166
|
-
ob_struct (dict): The structure defining the object.
|
163
|
+
prop (dict): Information about the object.
|
167
164
|
|
168
165
|
Returns:
|
169
166
|
dict: The created object (qReturn). In case of an error, returns the error information.
|
170
167
|
"""
|
171
168
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "method": "CreateObject", "handle": doc_handle,
|
172
|
-
"params":
|
169
|
+
"params": {"qProp": prop}})
|
173
170
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
174
171
|
try:
|
175
172
|
return response['result']['qReturn']
|
@@ -223,8 +220,16 @@ class EngineAppApi:
|
|
223
220
|
return response['error']
|
224
221
|
|
225
222
|
def clear_all(self, doc_handle, locked_also=False, alt_state=""):
|
223
|
+
"""
|
224
|
+
Clear selections in fields for current state. Locked fields are not cleared by default.
|
225
|
+
|
226
|
+
Parameters:
|
227
|
+
doc_handle (int): The handle identifying the app document.
|
228
|
+
locked_also (bool): When true, clears the selection for locked fields.
|
229
|
+
alt_state (str): Alternate state name. When set, applies to alternate state instead of current.
|
230
|
+
"""
|
226
231
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "ClearAll",
|
227
|
-
"params":
|
232
|
+
"params": {"qLockedAlso": locked_also, "qStateName": alt_state}})
|
228
233
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
229
234
|
try:
|
230
235
|
return response['result']
|
@@ -250,45 +255,24 @@ class EngineAppApi:
|
|
250
255
|
# can contain the same dimension.
|
251
256
|
# Parameters:
|
252
257
|
# qProp (MANDATORY: send dim_id, dim_title, dim_grouping, dim_field, dim_label, meta_def (optional) # NOQA
|
253
|
-
def
|
254
|
-
dim_grouping="N", dim_field='', dim_label='',
|
255
|
-
meta_def=""):
|
258
|
+
def create_dimension(self, doc_handle, prop):
|
256
259
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "CreateDimension",
|
257
|
-
"params":
|
258
|
-
"qInfo": {
|
259
|
-
"qId": dim_id,
|
260
|
-
"qType": "Dimension"
|
261
|
-
},
|
262
|
-
"qDim": {
|
263
|
-
"title": dim_title,
|
264
|
-
"qGrouping": dim_grouping,
|
265
|
-
"qFieldDefs": [
|
266
|
-
dim_field
|
267
|
-
],
|
268
|
-
"qFieldLabels": [
|
269
|
-
dim_label
|
270
|
-
]
|
271
|
-
},
|
272
|
-
"qMetaDef": {
|
273
|
-
"title": meta_def
|
274
|
-
}
|
275
|
-
}]
|
276
|
-
})
|
260
|
+
"params": {"qProp": prop}})
|
277
261
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
278
262
|
try:
|
279
|
-
return response[
|
263
|
+
return response["result"]["qReturn"]
|
280
264
|
except KeyError:
|
281
265
|
return response['error']
|
282
266
|
|
283
267
|
# DestroyDimension method: Removes a dimension
|
284
|
-
def
|
268
|
+
def destroy_dimension(self, doc_handle, dim_id):
|
285
269
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "DestroyDimension",
|
286
|
-
"params":
|
270
|
+
"params": {"qId": dim_id}})
|
287
271
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
288
272
|
try:
|
289
|
-
return response[
|
273
|
+
return response["result"]["qSuccess"]
|
290
274
|
except KeyError:
|
291
|
-
return response[
|
275
|
+
return response["error"]
|
292
276
|
|
293
277
|
# DestroyMeasure method: Removes a measure
|
294
278
|
def destroy_measure(self, doc_handle, measure_id):
|
@@ -347,25 +331,12 @@ class EngineAppApi:
|
|
347
331
|
# can contain the same dimension.
|
348
332
|
# Parameters:
|
349
333
|
# qProp (MANDATORY: send dim_id, dim_title, dim_grouping, dim_field, dim_label, meta_def (optional) # NOQA
|
350
|
-
def
|
351
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle,
|
352
|
-
"
|
353
|
-
"qInfo": {
|
354
|
-
"qId": measure_id,
|
355
|
-
"qType": "Measure"
|
356
|
-
},
|
357
|
-
"qMeasure": {
|
358
|
-
"qLabel": measure_title,
|
359
|
-
"qDef": measure_expr
|
360
|
-
},
|
361
|
-
"qMetaDef": {
|
362
|
-
"title": measure_title
|
363
|
-
}
|
364
|
-
}]
|
365
|
-
})
|
334
|
+
def create_measure(self, doc_handle, prop):
|
335
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "CreateMeasure",
|
336
|
+
"params": {"qProp": prop}})
|
366
337
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
367
338
|
try:
|
368
|
-
return response[
|
339
|
+
return response["result"]["qReturn"]
|
369
340
|
except KeyError:
|
370
341
|
return response['error']
|
371
342
|
|
@@ -702,9 +673,9 @@ class EngineAppApi:
|
|
702
673
|
except KeyError:
|
703
674
|
return response['error']
|
704
675
|
|
705
|
-
def create_session_object(self, doc_handle,
|
676
|
+
def create_session_object(self, doc_handle, prop):
|
706
677
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": doc_handle, "method": "CreateSessionObject",
|
707
|
-
"params":
|
678
|
+
"params": {"qProp": prop}})
|
708
679
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
709
680
|
try:
|
710
681
|
return response['result']['qReturn']
|
@@ -18,77 +18,87 @@ class EngineFieldApi:
|
|
18
18
|
"""
|
19
19
|
self.engine_socket = socket
|
20
20
|
|
21
|
-
def select(self, fld_handle, value):
|
21
|
+
def select(self, fld_handle, value, soft_lock = False, excluded_values_mode = 0):
|
22
22
|
"""
|
23
|
-
Selects
|
23
|
+
Selects field values matching a search string.
|
24
24
|
|
25
25
|
Args:
|
26
26
|
fld_handle (int): The handle of the field.
|
27
|
-
value (str):
|
27
|
+
value (str): String to search for. Can contain wild cards or numeric search criteria.
|
28
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
29
|
+
excluded_values_mode (int): Include excluded values in search.
|
28
30
|
|
29
31
|
Returns:
|
30
32
|
dict: The response from the engine, containing the result or an error message.
|
31
33
|
"""
|
32
34
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "Select",
|
33
|
-
"params":
|
35
|
+
"params": {"qMatch": value, "qSoftLock": soft_lock,
|
36
|
+
"qExcludedValuesMode": excluded_values_mode}})
|
34
37
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
35
38
|
try:
|
36
39
|
return response
|
37
40
|
except KeyError:
|
38
41
|
return response["error"]
|
39
42
|
|
40
|
-
def select_values(self, fld_handle, values=
|
43
|
+
def select_values(self, fld_handle, values, toggle_mode = False, soft_lock = False):
|
41
44
|
"""
|
42
45
|
Selects multiple values in a field.
|
43
46
|
|
44
47
|
Args:
|
45
48
|
fld_handle (int): The handle of the field.
|
46
|
-
values (list
|
49
|
+
values (list): A list of field values to select. Mandatory field.
|
50
|
+
toggle_mode (bool): The default value is false.
|
51
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
52
|
+
The default value is false.
|
47
53
|
|
48
54
|
Returns:
|
49
55
|
dict: The response from the engine, containing the result or an error message.
|
50
56
|
"""
|
51
|
-
if values is None:
|
52
|
-
values = []
|
53
57
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectValues",
|
54
|
-
"params":
|
58
|
+
"params": {"qFieldValues": values, "qToggleMode": toggle_mode, "qSoftLock": soft_lock}})
|
55
59
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
56
60
|
try:
|
57
|
-
return response
|
61
|
+
return response["result"]["qReturn"]
|
58
62
|
except KeyError:
|
59
63
|
return response["error"]
|
60
64
|
|
61
|
-
def select_excluded(self, fld_handle):
|
65
|
+
def select_excluded(self, fld_handle, soft_lock=False):
|
62
66
|
"""
|
63
|
-
|
67
|
+
Inverts the current selections.
|
64
68
|
|
65
69
|
Args:
|
66
70
|
fld_handle (int): The handle of the field.
|
71
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
72
|
+
The default value is false.
|
67
73
|
|
68
74
|
Returns:
|
69
|
-
|
75
|
+
bool: true/false. The operation is successful if qReturn is set to true.
|
70
76
|
"""
|
71
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectExcluded",
|
77
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectExcluded",
|
78
|
+
"params": {"qSoftLock": soft_lock}})
|
72
79
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
73
80
|
try:
|
74
|
-
return response["result"]
|
81
|
+
return response["result"]["qReturn"]
|
75
82
|
except KeyError:
|
76
83
|
return response["error"]
|
77
84
|
|
78
|
-
def select_possible(self, fld_handle):
|
85
|
+
def select_possible(self, fld_handle, soft_lock=False):
|
79
86
|
"""
|
80
87
|
Selects all possible values in a field.
|
81
88
|
|
82
89
|
Args:
|
83
90
|
fld_handle (int): The handle of the field.
|
91
|
+
soft_lock (bool): Set to true to ignore locks; in that case, locked fields can be selected.
|
92
|
+
The default value is false.
|
84
93
|
|
85
94
|
Returns:
|
86
|
-
|
95
|
+
bool: true/false. The operation is successful if qReturn is set to true.
|
87
96
|
"""
|
88
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectPossible",
|
97
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "SelectPossible",
|
98
|
+
"params": {"qSoftLock": soft_lock}})
|
89
99
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
90
100
|
try:
|
91
|
-
return response["result"]
|
101
|
+
return response["result"]["qReturn"]
|
92
102
|
except KeyError:
|
93
103
|
return response["error"]
|
94
104
|
|
@@ -102,7 +112,7 @@ class EngineFieldApi:
|
|
102
112
|
Returns:
|
103
113
|
dict: The response from the engine, containing the result or an error message.
|
104
114
|
"""
|
105
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "Clear", "params":
|
115
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "Clear", "params": {}})
|
106
116
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
107
117
|
try:
|
108
118
|
return response["result"]
|
@@ -119,9 +129,9 @@ class EngineFieldApi:
|
|
119
129
|
Returns:
|
120
130
|
int: The number of distinct values in the field, or an error message.
|
121
131
|
"""
|
122
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "GetCardinal", "params":
|
132
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": fld_handle, "method": "GetCardinal", "params": {}})
|
123
133
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
124
134
|
try:
|
125
|
-
return response["result"]
|
135
|
+
return response["result"]["qReturn"]
|
126
136
|
except KeyError:
|
127
137
|
return response["error"]
|
{qe_api_client-2.0.0 → qe_api_client-2.2.0}/qe_api_client/api_classes/engine_generic_object_api.py
RENAMED
@@ -7,6 +7,7 @@ class EngineGenericObjectApi:
|
|
7
7
|
data visualization objects.
|
8
8
|
|
9
9
|
Methods:
|
10
|
+
create_child(handle, params): Creates a generic object that is a child of another generic object.
|
10
11
|
get_layout(handle): Retrieves the layout structure of a generic object.
|
11
12
|
get_full_property_tree(handle): Retrieves the full property tree of a generic object.
|
12
13
|
get_effective_properties(handle): Retrieves the effective properties of a generic object.
|
@@ -23,6 +24,23 @@ class EngineGenericObjectApi:
|
|
23
24
|
socket (object): The socket connection to the Qlik Sense engine.
|
24
25
|
"""
|
25
26
|
self.engine_socket = socket
|
27
|
+
def create_child(self, handle, params):
|
28
|
+
"""
|
29
|
+
Retrieves the layout structure of a specific generic object.
|
30
|
+
|
31
|
+
Parameters:
|
32
|
+
handle (int): The handle identifying the generic object.
|
33
|
+
params (str): The parameters of the generic object.
|
34
|
+
|
35
|
+
Returns:
|
36
|
+
dict: The layout structure of the generic object (qLayout). In case of an error, returns the error information.
|
37
|
+
"""
|
38
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "CreateChild", "params": [params]})
|
39
|
+
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
40
|
+
try:
|
41
|
+
return response["result"]
|
42
|
+
except KeyError:
|
43
|
+
return response["error"]
|
26
44
|
|
27
45
|
def get_layout(self, handle):
|
28
46
|
"""
|
@@ -76,7 +94,7 @@ class EngineGenericObjectApi:
|
|
76
94
|
except KeyError:
|
77
95
|
return response["error"]
|
78
96
|
|
79
|
-
def get_hypercube_data(self, handle, path="/qHyperCubeDef", pages=
|
97
|
+
def get_hypercube_data(self, handle, path="/qHyperCubeDef", pages={}):
|
80
98
|
"""
|
81
99
|
Retrieves the data from a specific hypercube in a generic object.
|
82
100
|
|
@@ -89,14 +107,14 @@ class EngineGenericObjectApi:
|
|
89
107
|
dict: The data from the hypercube. In case of an error, returns the error information.
|
90
108
|
"""
|
91
109
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "GetHyperCubeData",
|
92
|
-
"params":
|
110
|
+
"params": {"qPath": path, "qPages": [pages]}})
|
93
111
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
94
112
|
try:
|
95
113
|
return response["result"]
|
96
114
|
except KeyError:
|
97
115
|
return response["error"]
|
98
116
|
|
99
|
-
def get_hypercube_pivot_data(self, handle, path="/qHyperCubeDef", pages=
|
117
|
+
def get_hypercube_pivot_data(self, handle, path="/qHyperCubeDef", pages={}):
|
100
118
|
"""
|
101
119
|
Retrieves the pivot data from a specific hypercube in a generic object.
|
102
120
|
|
@@ -108,16 +126,15 @@ class EngineGenericObjectApi:
|
|
108
126
|
Returns:
|
109
127
|
dict: The pivot data from the hypercube. In case of an error, returns the error information.
|
110
128
|
"""
|
111
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle,
|
112
|
-
"
|
113
|
-
"params": [path, pages]})
|
129
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "GetHyperCubePivotData",
|
130
|
+
"params": {"qPath": path, "qPages": [pages]}})
|
114
131
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
115
132
|
try:
|
116
133
|
return response["result"]
|
117
134
|
except KeyError:
|
118
135
|
return response["error"]
|
119
136
|
|
120
|
-
def get_hypercube_stack_data(self, handle, path="/qHyperCubeDef", pages=
|
137
|
+
def get_hypercube_stack_data(self, handle, path="/qHyperCubeDef", pages={}, max_no_cells=10000):
|
121
138
|
"""
|
122
139
|
Retrieves the values of a stacked pivot table. It is possible to retrieve specific pages of data.
|
123
140
|
|
@@ -132,7 +149,7 @@ class EngineGenericObjectApi:
|
|
132
149
|
dict: The pivot data from the hypercube. In case of an error, returns the error information.
|
133
150
|
"""
|
134
151
|
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": handle, "method": "GetHyperCubeStackData",
|
135
|
-
"params":
|
152
|
+
"params": {"qPath": path, "qPages": [pages], "qMaxNbrCells": max_no_cells}})
|
136
153
|
response = json.loads(self.engine_socket.send_call(self.engine_socket, msg))
|
137
154
|
try:
|
138
155
|
return response["result"]
|
@@ -85,7 +85,8 @@ class EngineGlobalApi:
|
|
85
85
|
Returns:
|
86
86
|
dict: Information about the deletion result.
|
87
87
|
"""
|
88
|
-
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "DeleteApp",
|
88
|
+
msg = json.dumps({"jsonrpc": "2.0", "id": 0, "handle": -1, "method": "DeleteApp",
|
89
|
+
"params": {"qAppId": app_name}})
|
89
90
|
response = json.loads(
|
90
91
|
self.engine_socket.send_call(self.engine_socket, msg))
|
91
92
|
try:
|