aliyun-log-python-sdk 0.9.0__tar.gz → 0.9.2__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.
- {aliyun-log-python-sdk-0.9.0/aliyun_log_python_sdk.egg-info → aliyun-log-python-sdk-0.9.2}/PKG-INFO +8 -1
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/consumer_client.py +1 -1
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/gethistogramsrequest.py +21 -2
- aliyun-log-python-sdk-0.9.2/aliyun/log/getlogsresponse.py +567 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logclient.py +27 -7
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/queriedlog.py +22 -1
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/util.py +48 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/version.py +1 -1
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2/aliyun_log_python_sdk.egg-info}/PKG-INFO +8 -1
- aliyun-log-python-sdk-0.9.0/aliyun/log/getlogsresponse.py +0 -203
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/LICENSE +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/README.md +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/acl_config.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/acl_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/auth.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/common_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/checkpoint_tracker.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/config.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/exceptions.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/fetched_log_group.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/heart_beat.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/shard_worker.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/tasks.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/worker.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer_group_request.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer_group_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/cursor_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/cursor_time_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/doc_logitem_converter.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/index_logstore_mappings.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/mapping_index_converter.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/migration_log.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/migration_manager.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/migration_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/migration_task.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/es_migration/util.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_config_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/config_parser.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/etl_util.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/exceptions.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/restrict_config_parser.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/runner.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/settings.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_base.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_csv.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_json.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_kv.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_lookup.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_mv.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_regex.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/trans_comp/trans_set_field.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/transform/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/transform/condition_list.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/transform/condition_transform.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/transform/condition_util.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/transform/transform_base.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/transform/transform_list.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/etl_core/transform/transform_meta.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/export_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/ext/__init__.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/ext/jupyter_magic.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/ext/syslogclient.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/external_store_config.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/external_store_config_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/getcontextlogsresponse.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/gethistogramsresponse.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/getlogsrequest.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/histogram.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/index_config.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/index_config_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/ingestion_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/job.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/listlogstoresrequest.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/listlogstoresresponse.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/listtopicsrequest.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/listtopicsresponse.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/log_logs_pb2.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/log_logs_raw_pb2.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logclient_core.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logclient_operator.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logexception.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logger_hanlder.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logitem.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logrequest.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logresponse.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logstore_config_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logtail_config_detail.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/logtail_config_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/machine_group_detail.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/machinegroup_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/odps_sink.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/oss_sink.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/pluralize.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/project_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/pulllog_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/putlogsrequest.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/putlogsresponse.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/resource_params.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/resource_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/scheduled_sql.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/scheduled_sql_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/shard_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/shipper_config.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/shipper_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/sink.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/sql_instance_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/substore_config_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/tag_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/topostore_params.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/topostore_response.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun_log_python_sdk.egg-info/SOURCES.txt +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun_log_python_sdk.egg-info/dependency_links.txt +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun_log_python_sdk.egg-info/requires.txt +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun_log_python_sdk.egg-info/top_level.txt +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/setup.cfg +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/setup.py +0 -0
- {aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/tests/test_alert.py +0 -0
{aliyun-log-python-sdk-0.9.0/aliyun_log_python_sdk.egg-info → aliyun-log-python-sdk-0.9.2}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: aliyun-log-python-sdk
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.2
|
|
4
4
|
Summary: Aliyun log service Python client SDK
|
|
5
5
|
Home-page: https://github.com/aliyun/aliyun-log-python-sdk
|
|
6
6
|
Author: Aliyun
|
|
@@ -16,6 +16,13 @@ Classifier: Programming Language :: Python :: 3.6
|
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.7
|
|
17
17
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
18
18
|
License-File: LICENSE
|
|
19
|
+
Requires-Dist: six
|
|
20
|
+
Requires-Dist: requests
|
|
21
|
+
Requires-Dist: python-dateutil
|
|
22
|
+
Requires-Dist: elasticsearch
|
|
23
|
+
Requires-Dist: jmespath
|
|
24
|
+
Requires-Dist: dateparser
|
|
25
|
+
Requires-Dist: protobuf<4.0.0,>3.4.0
|
|
19
26
|
|
|
20
27
|
|
|
21
28
|
Python SDK for Alicloud Log Service
|
{aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/consumer/consumer_client.py
RENAMED
|
@@ -27,7 +27,7 @@ class ConsumerClient(object):
|
|
|
27
27
|
from .. import LogClient
|
|
28
28
|
|
|
29
29
|
self.mclient = LogClient(endpoint, access_key_id, access_key, security_token, auth_version=auth_version, region=region)
|
|
30
|
-
self.mclient.set_user_agent('%s-consumergroup-%s' % (USER_AGENT, consumer_group))
|
|
30
|
+
self.mclient.set_user_agent('%s-consumergroup-%s-%s' % (USER_AGENT, consumer_group, consumer))
|
|
31
31
|
if credentials_refresher is not None:
|
|
32
32
|
self.mclient.set_credentials_auto_refresher(credentials_refresher)
|
|
33
33
|
self.mproject = project
|
{aliyun-log-python-sdk-0.9.0 → aliyun-log-python-sdk-0.9.2}/aliyun/log/gethistogramsrequest.py
RENAMED
|
@@ -33,9 +33,12 @@ class GetHistogramsRequest(LogRequest):
|
|
|
33
33
|
|
|
34
34
|
:type to_time_nano_part: int
|
|
35
35
|
:param to_time_nano_part: nano part of query end time
|
|
36
|
+
|
|
37
|
+
:type shard_id: int
|
|
38
|
+
:param shard_id: specific shard id,-1 means all shard
|
|
36
39
|
"""
|
|
37
40
|
|
|
38
|
-
def __init__(self, project=None, logstore=None, fromTime=None, toTime=None, topic=None, query=None, accurate_query=True, from_time_nano_part=0
|
|
41
|
+
def __init__(self, project=None, logstore=None, fromTime=None, toTime=None, topic=None, query=None, accurate_query=True, from_time_nano_part=0, to_time_nano_part=0, shard_id=-1):
|
|
39
42
|
LogRequest.__init__(self, project)
|
|
40
43
|
self.logstore = logstore
|
|
41
44
|
self.fromTime = parse_timestamp(fromTime)
|
|
@@ -45,6 +48,7 @@ class GetHistogramsRequest(LogRequest):
|
|
|
45
48
|
self.accurate_query = accurate_query
|
|
46
49
|
self.from_time_nano_part = from_time_nano_part
|
|
47
50
|
self.to_time_nano_part = to_time_nano_part
|
|
51
|
+
self.shard_id = shard_id
|
|
48
52
|
|
|
49
53
|
def get_logstore(self):
|
|
50
54
|
""" Get logstore name
|
|
@@ -162,4 +166,19 @@ class GetHistogramsRequest(LogRequest):
|
|
|
162
166
|
:type to_time_nano_part: int
|
|
163
167
|
:param to_time_nano_part: to_time_nano_part part of query end time
|
|
164
168
|
"""
|
|
165
|
-
self.to_time_nano_part = to_time_nano_part
|
|
169
|
+
self.to_time_nano_part = to_time_nano_part
|
|
170
|
+
|
|
171
|
+
def set_shard_id(self, shard_id):
|
|
172
|
+
""" Set request shard_id
|
|
173
|
+
|
|
174
|
+
:type shard_id: int
|
|
175
|
+
:param shard_id: user defined shard_id
|
|
176
|
+
"""
|
|
177
|
+
self.shard_id = shard_id
|
|
178
|
+
|
|
179
|
+
def get_shard_id(self):
|
|
180
|
+
""" Get request shard_id
|
|
181
|
+
|
|
182
|
+
:return: int, shard_id
|
|
183
|
+
"""
|
|
184
|
+
return self.shard_id
|
|
@@ -0,0 +1,567 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# encoding: utf-8
|
|
3
|
+
|
|
4
|
+
# Copyright (C) Alibaba Cloud Computing
|
|
5
|
+
# All rights reserved.
|
|
6
|
+
|
|
7
|
+
from .logresponse import LogResponse
|
|
8
|
+
from .queriedlog import QueriedLog
|
|
9
|
+
from .logexception import LogException
|
|
10
|
+
from .util import Util
|
|
11
|
+
from enum import Enum
|
|
12
|
+
import json
|
|
13
|
+
|
|
14
|
+
class GetLogsResponse(LogResponse):
|
|
15
|
+
""" The response of the GetLog API from log.
|
|
16
|
+
|
|
17
|
+
:type resp: dict
|
|
18
|
+
:param resp: GetLogsResponse HTTP response body
|
|
19
|
+
|
|
20
|
+
:type header: dict
|
|
21
|
+
:param header: GetLogsResponse HTTP response header
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
class QueryMode(Enum):
|
|
25
|
+
""" The enum of query type"""
|
|
26
|
+
NORMAL = 0
|
|
27
|
+
PHRASE = 1
|
|
28
|
+
SCAN = 2
|
|
29
|
+
SCAN_SQL = 3
|
|
30
|
+
|
|
31
|
+
def __init__(self, resp, header):
|
|
32
|
+
LogResponse.__init__(self, header, resp)
|
|
33
|
+
try:
|
|
34
|
+
self._meta = GetLogsResponse.GetLogsResponseMeta(
|
|
35
|
+
resp.get("meta"))
|
|
36
|
+
self._logs = []
|
|
37
|
+
for log in resp["data"]:
|
|
38
|
+
self._logs.append(QueriedLog._from_dict(log))
|
|
39
|
+
|
|
40
|
+
except Exception as ex:
|
|
41
|
+
raise LogException("InvalidResponse",
|
|
42
|
+
"Failed to parse GetLogResponse, \nheader: "
|
|
43
|
+
+ str(header) + " \nBody:"
|
|
44
|
+
+ str(resp) + " \nOther: " + str(ex),
|
|
45
|
+
resp_header=header,
|
|
46
|
+
resp_body=resp)
|
|
47
|
+
|
|
48
|
+
@staticmethod
|
|
49
|
+
def _from_v1_resp(resp, header):
|
|
50
|
+
"""
|
|
51
|
+
Support old api with best effort
|
|
52
|
+
"""
|
|
53
|
+
meta_dict = {
|
|
54
|
+
'count': len(resp),
|
|
55
|
+
'progress': Util.h_v_t(header, 'x-log-progress'),
|
|
56
|
+
'processedRows': int(Util.h_v_td(header, 'x-log-processed-rows', '0')),
|
|
57
|
+
'elapsedMillisecond': int(Util.h_v_td(header, 'x-log-elapsed-millisecond', '0')),
|
|
58
|
+
'hasSQL': (Util.h_v_td(header, 'x-log-has-sql', 'false') != 'false'),
|
|
59
|
+
'whereQuery': Util.h_v_td(header, 'x-log-where-query', ''),
|
|
60
|
+
'aggQuery': Util.h_v_td(header, 'x-log-agg-query', ''),
|
|
61
|
+
'cpuSec': float(Util.h_v_td(header, 'x-log-cpu-sec', '0')),
|
|
62
|
+
'cpuCores': int(Util.h_v_td(header, 'x-log-cpu-cores', '0')),
|
|
63
|
+
}
|
|
64
|
+
# parse query info
|
|
65
|
+
query_info_str = Util.h_v_td(header, 'x-log-query-info', '')
|
|
66
|
+
query_info = json.loads(query_info_str)
|
|
67
|
+
meta_dict['mode'] = Util.h_v_td(query_info, 'mode', 0)
|
|
68
|
+
query_mode = GetLogsResponse.QueryMode(meta_dict['mode'])
|
|
69
|
+
if query_mode in (GetLogsResponse.QueryMode.SCAN, GetLogsResponse.QueryMode.SCAN_SQL):
|
|
70
|
+
meta_dict['scanBytes'] = Util.h_v_td(query_info, 'scanBytes', 0)
|
|
71
|
+
if query_mode in (GetLogsResponse.QueryMode.PHRASE, GetLogsResponse.QueryMode.SCAN):
|
|
72
|
+
scan_query_info = Util.h_v_td(query_info, 'phraseQueryInfo', dict())
|
|
73
|
+
meta_dict['phraseQueryInfo'] = {
|
|
74
|
+
'scanAll': (Util.h_v_td(scan_query_info, 'scanAll', 'false') != 'false'),
|
|
75
|
+
'beginOffset': int(Util.h_v_td(scan_query_info, 'beginOffset', '0')),
|
|
76
|
+
'endOffset': int(Util.h_v_td(scan_query_info, 'endOffset', '0'))
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return GetLogsResponse({
|
|
80
|
+
"meta": meta_dict,
|
|
81
|
+
"data": resp
|
|
82
|
+
}, header)
|
|
83
|
+
|
|
84
|
+
def get_count(self):
|
|
85
|
+
""" Get log number from the response
|
|
86
|
+
|
|
87
|
+
:return: int, log number
|
|
88
|
+
"""
|
|
89
|
+
return self.get_meta().get_count()
|
|
90
|
+
|
|
91
|
+
def is_completed(self):
|
|
92
|
+
""" Check if the get logs query is completed
|
|
93
|
+
|
|
94
|
+
:return: bool, true if this logs query is completed
|
|
95
|
+
"""
|
|
96
|
+
return self.get_meta().is_completed()
|
|
97
|
+
|
|
98
|
+
def get_logs(self):
|
|
99
|
+
""" Get all logs from the response
|
|
100
|
+
|
|
101
|
+
:return: QueriedLog list, all log data
|
|
102
|
+
"""
|
|
103
|
+
return self._logs
|
|
104
|
+
|
|
105
|
+
def get_processed_rows(self):
|
|
106
|
+
""" Get processed rows from the response
|
|
107
|
+
|
|
108
|
+
:return: int, processed_rows
|
|
109
|
+
"""
|
|
110
|
+
return self.get_meta().get_processed_rows()
|
|
111
|
+
|
|
112
|
+
def get_elapsed_mills(self):
|
|
113
|
+
""" Get elapsed mills from the response
|
|
114
|
+
|
|
115
|
+
:return: int, elapsed_mills
|
|
116
|
+
"""
|
|
117
|
+
return self.get_meta().get_elapsed_millisecond()
|
|
118
|
+
|
|
119
|
+
def get_has_sql(self):
|
|
120
|
+
""" Get whether has sql from the response
|
|
121
|
+
|
|
122
|
+
:return: boolean, has_sql
|
|
123
|
+
"""
|
|
124
|
+
return self.get_meta().get_has_sql()
|
|
125
|
+
|
|
126
|
+
def get_where_query(self):
|
|
127
|
+
""" Get the Search part of "Search|Analysis"
|
|
128
|
+
|
|
129
|
+
:return: str, where_query
|
|
130
|
+
"""
|
|
131
|
+
return self.get_meta().get_where_query()
|
|
132
|
+
|
|
133
|
+
def get_agg_query(self):
|
|
134
|
+
""" Get the Analysis part of "Search|Analysis"
|
|
135
|
+
|
|
136
|
+
:return: str, agg_query
|
|
137
|
+
"""
|
|
138
|
+
return self.get_meta().get_agg_query()
|
|
139
|
+
|
|
140
|
+
def get_cpu_sec(self):
|
|
141
|
+
""" Get cpu seconds used from the response
|
|
142
|
+
|
|
143
|
+
:return: float, cpu_sec
|
|
144
|
+
"""
|
|
145
|
+
return self.get_meta().get_cpu_sec()
|
|
146
|
+
|
|
147
|
+
def get_cpu_cores(self):
|
|
148
|
+
""" Get cpu cores used from the response
|
|
149
|
+
|
|
150
|
+
:return: int, cpu_cores
|
|
151
|
+
"""
|
|
152
|
+
return self.get_meta().get_cpu_cores()
|
|
153
|
+
|
|
154
|
+
def get_query_mode(self):
|
|
155
|
+
""" Get query_mode from the response
|
|
156
|
+
|
|
157
|
+
:return: GetLogsResponse.QueryMode, query_mode
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
return GetLogsResponse.QueryMode(self.get_meta().get_mode())
|
|
161
|
+
|
|
162
|
+
def get_scan_bytes(self):
|
|
163
|
+
""" Get scan_bytes from the response
|
|
164
|
+
|
|
165
|
+
:return: int, scan_bytes
|
|
166
|
+
"""
|
|
167
|
+
return self.get_meta().get_scan_bytes()
|
|
168
|
+
|
|
169
|
+
def get_begin_offset(self):
|
|
170
|
+
""" Get begin_offset from the response
|
|
171
|
+
|
|
172
|
+
:return: int, begin_offset
|
|
173
|
+
"""
|
|
174
|
+
phrase_query_info = self.get_meta().get_phrase_query_info()
|
|
175
|
+
return phrase_query_info.get_begin_offset() if phrase_query_info else None
|
|
176
|
+
|
|
177
|
+
def get_end_offset(self):
|
|
178
|
+
""" Get end_offset from the response
|
|
179
|
+
|
|
180
|
+
:return: int, end_offset
|
|
181
|
+
"""
|
|
182
|
+
phrase_query_info = self.get_meta().get_phrase_query_info()
|
|
183
|
+
return phrase_query_info.get_end_offset() if phrase_query_info else None
|
|
184
|
+
|
|
185
|
+
def get_scan_all(self):
|
|
186
|
+
""" Get scan_all from the response
|
|
187
|
+
|
|
188
|
+
:return: bool, scan_all
|
|
189
|
+
"""
|
|
190
|
+
phrase_query_info = self.get_meta().get_phrase_query_info()
|
|
191
|
+
return phrase_query_info.get_scan_all() if phrase_query_info else None
|
|
192
|
+
|
|
193
|
+
def log_print(self):
|
|
194
|
+
print('GetLogsResponse:')
|
|
195
|
+
print('headers:', self.get_all_headers())
|
|
196
|
+
print('count:', self.get_count())
|
|
197
|
+
print('progress:', self.get_meta().get_progress())
|
|
198
|
+
print('meta:', self.get_meta()._to_dict())
|
|
199
|
+
print("\nQueriedLog class:\n")
|
|
200
|
+
for log in self.get_logs():
|
|
201
|
+
log.log_print()
|
|
202
|
+
print("\n")
|
|
203
|
+
|
|
204
|
+
def get_log_list(self):
|
|
205
|
+
print('count:', self.get_count())
|
|
206
|
+
print('progress:', self.get_meta().get_progress())
|
|
207
|
+
return self.get_logs()
|
|
208
|
+
|
|
209
|
+
def get_meta(self):
|
|
210
|
+
""" Get meta from the response
|
|
211
|
+
|
|
212
|
+
:return: meta, GetLogsResponseMeta
|
|
213
|
+
"""
|
|
214
|
+
return self._meta
|
|
215
|
+
|
|
216
|
+
def merge(self, other):
|
|
217
|
+
""" merge with other response
|
|
218
|
+
merge logs and meta
|
|
219
|
+
"""
|
|
220
|
+
if not isinstance(other, GetLogsResponse):
|
|
221
|
+
raise ValueError(
|
|
222
|
+
"passed response is not a GetLogsResponse: " + str(type(other)))
|
|
223
|
+
if other is None:
|
|
224
|
+
return self
|
|
225
|
+
self.get_meta().merge(other.get_meta())
|
|
226
|
+
self.get_logs().extend(other.get_logs())
|
|
227
|
+
return self
|
|
228
|
+
|
|
229
|
+
class GetLogsResponseMeta():
|
|
230
|
+
""" The meta info of get logs response
|
|
231
|
+
|
|
232
|
+
"""
|
|
233
|
+
|
|
234
|
+
def __init__(self, meta):
|
|
235
|
+
self._count = Util.v_or_d(meta.get("count"), 0)
|
|
236
|
+
self._progress = meta.get("progress")
|
|
237
|
+
self._processed_rows = Util.v_or_d(meta.get("processedRows"), 0)
|
|
238
|
+
self._elapsed_millisecond = Util.v_or_d(meta.get("elapsedMillisecond"), 0)
|
|
239
|
+
self._has_sql = Util.v_or_d(meta.get("hasSQL"), False)
|
|
240
|
+
self._where_query = Util.v_or_d(meta.get("whereQuery"), '')
|
|
241
|
+
self._agg_query = Util.v_or_d(meta.get("aggQuery"))
|
|
242
|
+
self._cpu_sec = Util.v_or_d(meta.get("cpuSec"), 0.0)
|
|
243
|
+
self._cpu_cores = Util.v_or_d(meta.get("cpuCores"), 0)
|
|
244
|
+
self._mode = Util.v_or_d(meta.get("mode"), 0)
|
|
245
|
+
self._scan_bytes = Util.v_or_d(meta.get("scanBytes"), 0)
|
|
246
|
+
phrase_query_info = meta.get("phraseQueryInfo")
|
|
247
|
+
self._phrase_query_info = GetLogsResponse.PhraseQueryInfo(
|
|
248
|
+
phrase_query_info) if phrase_query_info else None
|
|
249
|
+
|
|
250
|
+
# self._limited = meta.get("limited")
|
|
251
|
+
# self._processed_bytes = meta.get("processedBytes")
|
|
252
|
+
# self._telemetry_type = meta.get("telementryType") # not typo
|
|
253
|
+
# self._power_sql = Util.v_or_d(meta.get("powerSql"), False)
|
|
254
|
+
# self._inserted_sql = meta.get("insertedSQL")
|
|
255
|
+
# self._keys = meta.get("keys")
|
|
256
|
+
# self._marker = meta.get("marker")
|
|
257
|
+
# self._shard = meta.get("shard")
|
|
258
|
+
# self._is_accurate = meta.get("isAccurate")
|
|
259
|
+
# self._column_types = meta.get("columnTypes")
|
|
260
|
+
# self._highlights = meta.get("highlights")
|
|
261
|
+
# self._terms = []
|
|
262
|
+
# for term in meta.get("terms", []):
|
|
263
|
+
# self._terms.append(GetLogsResponse.Term._from_dict(term))
|
|
264
|
+
|
|
265
|
+
def is_completed(self):
|
|
266
|
+
""" Check if the get logs query is completed
|
|
267
|
+
|
|
268
|
+
:return: bool, true if this logs query is completed
|
|
269
|
+
"""
|
|
270
|
+
return self.get_progress() == 'Complete'
|
|
271
|
+
|
|
272
|
+
def merge(self, other):
|
|
273
|
+
""" merge with other GetLogsResponseMeta
|
|
274
|
+
|
|
275
|
+
"""
|
|
276
|
+
self._progress = other.get_progress()
|
|
277
|
+
self._count += other.get_count()
|
|
278
|
+
self._processed_rows += other.get_processed_rows()
|
|
279
|
+
return self
|
|
280
|
+
|
|
281
|
+
def get_count(self):
|
|
282
|
+
""" Get log number from the response
|
|
283
|
+
|
|
284
|
+
:return: int, log number
|
|
285
|
+
"""
|
|
286
|
+
return self._count
|
|
287
|
+
|
|
288
|
+
def _to_dict(self):
|
|
289
|
+
""" to Dict
|
|
290
|
+
"""
|
|
291
|
+
phrase_query_info = self.get_phrase_query_info()
|
|
292
|
+
phrase_query_info_dict = phrase_query_info._to_dict() if phrase_query_info is not None else None
|
|
293
|
+
|
|
294
|
+
return {
|
|
295
|
+
'count': self.get_count(),
|
|
296
|
+
'progress': self.get_progress(),
|
|
297
|
+
'processedRows': self.get_processed_rows(),
|
|
298
|
+
'elapsedMillisecond': self.get_elapsed_millisecond(),
|
|
299
|
+
'hasSQL': self.get_has_sql(),
|
|
300
|
+
'whereQuery': self.get_where_query(),
|
|
301
|
+
'aggQuery': self.get_agg_query(),
|
|
302
|
+
'cpuSec': self.get_cpu_sec(),
|
|
303
|
+
'cpuCores': self.get_cpu_cores(),
|
|
304
|
+
'mode': self.get_mode(),
|
|
305
|
+
'scanBytes': self.get_scan_bytes(),
|
|
306
|
+
'phraseQueryInfo': phrase_query_info_dict,
|
|
307
|
+
# 'limited': self._limited,
|
|
308
|
+
# 'processedBytes': self._processed_bytes,
|
|
309
|
+
# 'telementryType': self._telemetry_type, # not typo
|
|
310
|
+
# 'powerSql': self._power_sql,
|
|
311
|
+
# 'insertedSQL': self._inserted_sql,
|
|
312
|
+
# 'keys': self._keys,
|
|
313
|
+
# 'marker': self._marker,
|
|
314
|
+
# 'shard': self._shard,
|
|
315
|
+
# 'isAccurate': self._is_accurate,
|
|
316
|
+
# 'columnTypes': self._column_types,
|
|
317
|
+
# 'highlights': self._highlights,
|
|
318
|
+
# 'terms': [term.to_dict() for term in self._terms],
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
def log_print(self):
|
|
322
|
+
""" print infos
|
|
323
|
+
"""
|
|
324
|
+
print(self._to_dict())
|
|
325
|
+
|
|
326
|
+
def get_progress(self):
|
|
327
|
+
""" Progress of get logs, returns 'Complete' if completed
|
|
328
|
+
|
|
329
|
+
:return: str
|
|
330
|
+
"""
|
|
331
|
+
return self._progress
|
|
332
|
+
|
|
333
|
+
def get_processed_rows(self):
|
|
334
|
+
""" Get processed rows from the response
|
|
335
|
+
|
|
336
|
+
:return: processed_rows, int
|
|
337
|
+
"""
|
|
338
|
+
return self._processed_rows
|
|
339
|
+
|
|
340
|
+
def get_elapsed_millisecond(self):
|
|
341
|
+
""" Get elapsed mills from the response
|
|
342
|
+
|
|
343
|
+
:return: elapsed_millisecond, int
|
|
344
|
+
"""
|
|
345
|
+
return self._elapsed_millisecond
|
|
346
|
+
|
|
347
|
+
def get_has_sql(self):
|
|
348
|
+
""" Get whether has sql from the response
|
|
349
|
+
|
|
350
|
+
:return: has_sql, boolean
|
|
351
|
+
"""
|
|
352
|
+
return self._has_sql
|
|
353
|
+
|
|
354
|
+
def get_where_query(self):
|
|
355
|
+
""" Get the Search part of "Search|Analysis"
|
|
356
|
+
|
|
357
|
+
:return: where_query, str
|
|
358
|
+
"""
|
|
359
|
+
return self._where_query
|
|
360
|
+
|
|
361
|
+
def get_agg_query(self):
|
|
362
|
+
""" Get the Analysis part of "Search|Analysis"
|
|
363
|
+
|
|
364
|
+
:return: agg_query, str
|
|
365
|
+
"""
|
|
366
|
+
return self._agg_query
|
|
367
|
+
|
|
368
|
+
def get_cpu_sec(self):
|
|
369
|
+
""" Get cpu seconds used from the response
|
|
370
|
+
|
|
371
|
+
:return: cpu_sec, float64
|
|
372
|
+
"""
|
|
373
|
+
return self._cpu_sec
|
|
374
|
+
|
|
375
|
+
def get_cpu_cores(self):
|
|
376
|
+
""" Get cpu cores used from the response
|
|
377
|
+
|
|
378
|
+
:return: cpu_cores, float64
|
|
379
|
+
"""
|
|
380
|
+
return self._cpu_cores
|
|
381
|
+
|
|
382
|
+
def get_mode(self):
|
|
383
|
+
""" Get query mode from the response
|
|
384
|
+
|
|
385
|
+
:return: mode
|
|
386
|
+
"""
|
|
387
|
+
return self._mode
|
|
388
|
+
|
|
389
|
+
def get_scan_bytes(self):
|
|
390
|
+
""" Get scan_bytes from the response
|
|
391
|
+
|
|
392
|
+
:return: scan_bytes, int
|
|
393
|
+
"""
|
|
394
|
+
return self._scan_bytes
|
|
395
|
+
|
|
396
|
+
def get_phrase_query_info(self):
|
|
397
|
+
"""
|
|
398
|
+
:return: phraseQueryInfo, PhraseQueryInfo
|
|
399
|
+
"""
|
|
400
|
+
return self._phrase_query_info
|
|
401
|
+
|
|
402
|
+
# def get_limited(self):
|
|
403
|
+
# """
|
|
404
|
+
# :return: limited, int
|
|
405
|
+
# """
|
|
406
|
+
# return self._limited
|
|
407
|
+
|
|
408
|
+
# def get_processed_bytes(self):
|
|
409
|
+
# """
|
|
410
|
+
# :return: processed_bytes, int
|
|
411
|
+
# """
|
|
412
|
+
# return self._processed_bytes
|
|
413
|
+
|
|
414
|
+
# def get_telemetry_type(self):
|
|
415
|
+
# """
|
|
416
|
+
# :return: telemetry_type, str
|
|
417
|
+
# """
|
|
418
|
+
# return self._telemetry_type
|
|
419
|
+
|
|
420
|
+
# def get_power_sql(self):
|
|
421
|
+
# """
|
|
422
|
+
# :return: power_sql, bool
|
|
423
|
+
# """
|
|
424
|
+
# return self._power_sql
|
|
425
|
+
|
|
426
|
+
# def get_inserted_sql(self):
|
|
427
|
+
# """
|
|
428
|
+
# :return: inserted_sql, str
|
|
429
|
+
# """
|
|
430
|
+
# return self._inserted_sql
|
|
431
|
+
|
|
432
|
+
# def get_keys(self):
|
|
433
|
+
# """
|
|
434
|
+
# :return: keys, List[str]
|
|
435
|
+
# """
|
|
436
|
+
# return self._keys
|
|
437
|
+
|
|
438
|
+
# def get_marker(self):
|
|
439
|
+
# """
|
|
440
|
+
# :return: marker, str
|
|
441
|
+
# """
|
|
442
|
+
# return self._marker
|
|
443
|
+
|
|
444
|
+
# def get_shard(self):
|
|
445
|
+
# """
|
|
446
|
+
# :return: shard, int
|
|
447
|
+
# """
|
|
448
|
+
# return self._shard
|
|
449
|
+
|
|
450
|
+
# def get_is_accurate(self):
|
|
451
|
+
# """
|
|
452
|
+
# :return: is_accurate, bool
|
|
453
|
+
# """
|
|
454
|
+
# return self._is_accurate
|
|
455
|
+
|
|
456
|
+
# def get_column_types(self):
|
|
457
|
+
# """
|
|
458
|
+
# :return: column_types, List[str]
|
|
459
|
+
# """
|
|
460
|
+
# return self._column_types
|
|
461
|
+
|
|
462
|
+
# def get_highlights(self):
|
|
463
|
+
# """
|
|
464
|
+
# :return: highlights, List[Dict]
|
|
465
|
+
# """
|
|
466
|
+
# return self._highlights
|
|
467
|
+
|
|
468
|
+
# def get_terms(self):
|
|
469
|
+
# """
|
|
470
|
+
# :return: terms, List[Term]
|
|
471
|
+
# """
|
|
472
|
+
# return self._terms
|
|
473
|
+
|
|
474
|
+
class PhraseQueryInfo():
|
|
475
|
+
""" query info of phrase, includes beginOffset/endOffset/scanAll/endTime
|
|
476
|
+
|
|
477
|
+
"""
|
|
478
|
+
|
|
479
|
+
def __init__(self, pharse_query_info):
|
|
480
|
+
self._begin_offset = pharse_query_info.get("beginOffset")
|
|
481
|
+
self._end_offset = pharse_query_info.get("endOffset")
|
|
482
|
+
self._scan_all = pharse_query_info.get("scanAll")
|
|
483
|
+
self._end_time = pharse_query_info.get("endTime")
|
|
484
|
+
|
|
485
|
+
def get_begin_offset(self):
|
|
486
|
+
""" Get begin_offset from the response
|
|
487
|
+
|
|
488
|
+
:return: begin_offset, int
|
|
489
|
+
"""
|
|
490
|
+
return self._begin_offset
|
|
491
|
+
|
|
492
|
+
def get_end_offset(self):
|
|
493
|
+
""" Get end_offset from the response
|
|
494
|
+
|
|
495
|
+
:return: end_offset, int
|
|
496
|
+
"""
|
|
497
|
+
return self._end_offset
|
|
498
|
+
|
|
499
|
+
def get_scan_all(self):
|
|
500
|
+
""" Get scan_all from the response
|
|
501
|
+
|
|
502
|
+
:return: scan_all, bool
|
|
503
|
+
"""
|
|
504
|
+
return self._scan_all
|
|
505
|
+
|
|
506
|
+
def get_end_time(self):
|
|
507
|
+
""" Get end_time from the response
|
|
508
|
+
|
|
509
|
+
:return: end_time, int
|
|
510
|
+
"""
|
|
511
|
+
return self._end_time
|
|
512
|
+
|
|
513
|
+
def _to_dict(self):
|
|
514
|
+
""" to Dict
|
|
515
|
+
"""
|
|
516
|
+
return {
|
|
517
|
+
"beginOffset": self.get_begin_offset(),
|
|
518
|
+
"endOffset": self.get_end_offset(),
|
|
519
|
+
"scanAll": self.get_scan_all(),
|
|
520
|
+
"endTime": self.get_end_time()
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
def log_print(self):
|
|
524
|
+
""" print info
|
|
525
|
+
|
|
526
|
+
"""
|
|
527
|
+
print(self._to_dict())
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
# class Term():
|
|
531
|
+
# """ terms of query, field key/term
|
|
532
|
+
# """
|
|
533
|
+
|
|
534
|
+
# def __init__(self, key, term):
|
|
535
|
+
# self._key = key
|
|
536
|
+
# self._term = term
|
|
537
|
+
|
|
538
|
+
# @classmethod
|
|
539
|
+
# def _from_dict(cls, data):
|
|
540
|
+
# """ Initialize from a dict
|
|
541
|
+
# """
|
|
542
|
+
# key = data.get("key")
|
|
543
|
+
# term = data.get("term")
|
|
544
|
+
# return cls(key, term)
|
|
545
|
+
|
|
546
|
+
# def get_key(self):
|
|
547
|
+
# """ field key of term
|
|
548
|
+
# """
|
|
549
|
+
# return self._key
|
|
550
|
+
|
|
551
|
+
# def get_term(self):
|
|
552
|
+
# """ field term of term
|
|
553
|
+
# """
|
|
554
|
+
# return self._term
|
|
555
|
+
|
|
556
|
+
# def _to_dict(self):
|
|
557
|
+
# """ to Dict
|
|
558
|
+
# """
|
|
559
|
+
# return {
|
|
560
|
+
# "key": self._key,
|
|
561
|
+
# "term": self._term
|
|
562
|
+
# }
|
|
563
|
+
|
|
564
|
+
# def log_print(self):
|
|
565
|
+
# """ print info
|
|
566
|
+
# """
|
|
567
|
+
# print(self._to_dict())
|