aliyun-log-python-sdk 0.9.22__tar.gz → 0.9.23__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.
Files changed (129) hide show
  1. {aliyun_log_python_sdk-0.9.22/aliyun_log_python_sdk.egg-info → aliyun_log_python_sdk-0.9.23}/PKG-INFO +1 -1
  2. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/compress.py +22 -7
  3. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/config.py +7 -1
  4. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/consumer_client.py +47 -5
  5. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/worker.py +2 -1
  6. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logclient.py +20 -4
  7. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/version.py +1 -1
  8. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23/aliyun_log_python_sdk.egg-info}/PKG-INFO +1 -1
  9. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/LICENSE +0 -0
  10. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/README.md +0 -0
  11. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/__init__.py +0 -0
  12. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/__init__.py +0 -0
  13. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/_proto_py2/__init__.py +0 -0
  14. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/_proto_py2/log_logs_pb2.py +0 -0
  15. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/_proto_py2/log_logs_raw_pb2.py +0 -0
  16. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/acl_config.py +0 -0
  17. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/acl_response.py +0 -0
  18. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/auth.py +0 -0
  19. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/common_response.py +0 -0
  20. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/__init__.py +0 -0
  21. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/checkpoint_tracker.py +0 -0
  22. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/exceptions.py +0 -0
  23. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/fetched_log_group.py +0 -0
  24. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/heart_beat.py +0 -0
  25. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/shard_worker.py +0 -0
  26. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer/tasks.py +0 -0
  27. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer_group_request.py +0 -0
  28. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/consumer_group_response.py +0 -0
  29. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/credentials.py +0 -0
  30. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/cursor_response.py +0 -0
  31. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/cursor_time_response.py +0 -0
  32. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/__init__.py +0 -0
  33. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/doc_logitem_converter.py +0 -0
  34. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/index_logstore_mappings.py +0 -0
  35. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/mapping_index_converter.py +0 -0
  36. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/migration_log.py +0 -0
  37. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/migration_manager.py +0 -0
  38. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/migration_response.py +0 -0
  39. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/migration_task.py +0 -0
  40. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/es_migration/util.py +0 -0
  41. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_config_response.py +0 -0
  42. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/__init__.py +0 -0
  43. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/config_parser.py +0 -0
  44. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/etl_util.py +0 -0
  45. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/exceptions.py +0 -0
  46. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/restrict_config_parser.py +0 -0
  47. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/runner.py +0 -0
  48. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/settings.py +0 -0
  49. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/__init__.py +0 -0
  50. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_base.py +0 -0
  51. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_csv.py +0 -0
  52. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_json.py +0 -0
  53. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_kv.py +0 -0
  54. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_lookup.py +0 -0
  55. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_mv.py +0 -0
  56. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_regex.py +0 -0
  57. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/trans_comp/trans_set_field.py +0 -0
  58. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/transform/__init__.py +0 -0
  59. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/transform/condition_list.py +0 -0
  60. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/transform/condition_transform.py +0 -0
  61. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/transform/condition_util.py +0 -0
  62. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/transform/transform_base.py +0 -0
  63. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/transform/transform_list.py +0 -0
  64. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/etl_core/transform/transform_meta.py +0 -0
  65. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/export_response.py +0 -0
  66. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/ext/__init__.py +0 -0
  67. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/ext/jupyter_magic.py +0 -0
  68. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/ext/syslogclient.py +0 -0
  69. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/external_store_config.py +0 -0
  70. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/external_store_config_response.py +0 -0
  71. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/getcontextlogsresponse.py +0 -0
  72. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/gethistogramsrequest.py +0 -0
  73. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/gethistogramsresponse.py +0 -0
  74. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/getlogsrequest.py +0 -0
  75. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/getlogsresponse.py +0 -0
  76. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/histogram.py +0 -0
  77. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/index_config.py +0 -0
  78. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/index_config_response.py +0 -0
  79. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/ingestion_response.py +0 -0
  80. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/job.py +0 -0
  81. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/listlogstoresrequest.py +0 -0
  82. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/listlogstoresresponse.py +0 -0
  83. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/listtopicsrequest.py +0 -0
  84. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/listtopicsresponse.py +0 -0
  85. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/log_logs_pb2.py +0 -0
  86. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/log_logs_raw_pb2.py +0 -0
  87. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logclient_core.py +0 -0
  88. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logclient_operator.py +0 -0
  89. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logexception.py +0 -0
  90. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logger_hanlder.py +0 -0
  91. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logitem.py +0 -0
  92. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logrequest.py +0 -0
  93. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logresponse.py +0 -0
  94. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logstore_config_response.py +0 -0
  95. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logtail_config_detail.py +0 -0
  96. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/logtail_config_response.py +0 -0
  97. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/machine_group_detail.py +0 -0
  98. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/machinegroup_response.py +0 -0
  99. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/odps_sink.py +0 -0
  100. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/oss_sink.py +0 -0
  101. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/pluralize.py +0 -0
  102. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/project_response.py +0 -0
  103. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/proto.py +0 -0
  104. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/pulllog_response.py +0 -0
  105. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/putlogsrequest.py +0 -0
  106. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/putlogsresponse.py +0 -0
  107. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/queriedlog.py +0 -0
  108. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/rebuild_index_response.py +0 -0
  109. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/resource_params.py +0 -0
  110. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/resource_response.py +0 -0
  111. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/scheduled_sql.py +0 -0
  112. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/scheduled_sql_response.py +0 -0
  113. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/shard_response.py +0 -0
  114. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/shipper_config.py +0 -0
  115. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/shipper_response.py +0 -0
  116. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/sink.py +0 -0
  117. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/sql_instance_response.py +0 -0
  118. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/substore_config_response.py +0 -0
  119. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/tag_response.py +0 -0
  120. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/topostore_params.py +0 -0
  121. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/topostore_response.py +0 -0
  122. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun/log/util.py +0 -0
  123. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun_log_python_sdk.egg-info/SOURCES.txt +0 -0
  124. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun_log_python_sdk.egg-info/dependency_links.txt +0 -0
  125. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun_log_python_sdk.egg-info/requires.txt +0 -0
  126. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/aliyun_log_python_sdk.egg-info/top_level.txt +0 -0
  127. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/setup.cfg +0 -0
  128. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/setup.py +0 -0
  129. {aliyun_log_python_sdk-0.9.22 → aliyun_log_python_sdk-0.9.23}/tests/test_alert.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.22
3
+ Version: 0.9.23
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
@@ -20,10 +20,19 @@ def lz_compresss(data):
20
20
 
21
21
  def zstd_compress(data):
22
22
  if not zstd_available:
23
- raise LogException('UnsupportedompressType',
24
- 'Unsupported compress type zstd, zstd not installed')
23
+ raise LogException('UnsupportedCompressType',
24
+ 'Unsupported compress type zstd, library zstd not installed')
25
25
  return zstd.compress(data, 1)
26
26
 
27
+ def zstd_decompress(raw_size, data):
28
+ if not zstd_available:
29
+ raise LogException('UnsupportedCompressType',
30
+ 'Unsupported compress type zstd, library zstd not installed')
31
+ result = zstd.decompress(data)
32
+ if len(result) != raw_size:
33
+ raise LogException('DecompressError', 'uncompressed size ' + str(len(result)) + ' does not match x-log-bodyrawsize ' + str(raw_size))
34
+ return result
35
+
27
36
  class CompressType(Enum):
28
37
  UNCOMPRESSED = 1
29
38
  LZ4 = 2
@@ -62,8 +71,8 @@ class Compressor():
62
71
  if compress_type == CompressType.UNCOMPRESSED:
63
72
  return data
64
73
 
65
- raise LogException('UnknownCompressType',
66
- 'Unknown compress type: ' + compress_type)
74
+ raise LogException('UnsupportedCompressType',
75
+ 'Unsupported compress type: ' + compress_type)
67
76
 
68
77
  @staticmethod
69
78
  def decompress(data, raw_size, compress_type):
@@ -73,9 +82,12 @@ class Compressor():
73
82
 
74
83
  if compress_type == CompressType.UNCOMPRESSED:
75
84
  return data
85
+
86
+ if compress_type == CompressType.ZSTD:
87
+ return zstd_decompress(raw_size, data)
76
88
 
77
- raise LogException('UnknownCompressType',
78
- 'Unknown compress type: ' + compress_type)
89
+ raise LogException('UnsupportedCompressType',
90
+ 'Unsupported compress type: ' + compress_type)
79
91
 
80
92
  @staticmethod
81
93
  def decompress_response(header, response):
@@ -93,8 +105,11 @@ class Compressor():
93
105
  if compress_type_str == 'lz4':
94
106
  return Compressor.decompress(response, raw_size, CompressType.LZ4)
95
107
 
108
+ if compress_type_str == 'zstd':
109
+ return Compressor.decompress(response, raw_size, CompressType.ZSTD)
110
+
96
111
  if compress_type_str in ('gzip', 'deflate'):
97
112
  return zlib.decompress(response)
98
113
 
99
- raise LogException('UnknownCompressType', 'Unknown compress type: ' +
114
+ raise LogException('UnsupportedCompressType', 'Unsupported compress type: ' +
100
115
  compress_type_str, resp_header=header, resp_body=response)
@@ -25,7 +25,8 @@ class LogHubConfig(object):
25
25
  cursor_position=None, heartbeat_interval=None, data_fetch_interval=None, in_order=False,
26
26
  cursor_start_time=None, security_token=None, max_fetch_log_group_size=None, worker_pool_size=None, shared_executor=None,
27
27
  cursor_end_time=None, credentials_refresher=None,
28
- auth_version=AUTH_VERSION_1, region='', query=None):
28
+ auth_version=AUTH_VERSION_1, region='', query=None,
29
+ accept_compress_type=None):
29
30
  """
30
31
 
31
32
  :param endpoint:
@@ -48,6 +49,10 @@ class LogHubConfig(object):
48
49
  :param auth_version: only support AUTH_VERSION_1 and AUTH_VERSION_4
49
50
  :param region: region of project
50
51
  :param query: the SPL query, such as *| where a = 'xxx'
52
+ :type accept_compress_type: string
53
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
54
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
55
+
51
56
  """
52
57
  self.endpoint = endpoint
53
58
  self.accessKeyId = access_key_id
@@ -71,3 +76,4 @@ class LogHubConfig(object):
71
76
  self.auth_version = auth_version
72
77
  self.region = region
73
78
  self.query = query
79
+ self.accept_compress_type = accept_compress_type
@@ -22,18 +22,60 @@ class ConsumerClientLoggerAdapter(logging.LoggerAdapter):
22
22
  class ConsumerClient(object):
23
23
  def __init__(self, endpoint, access_key_id, access_key, project,
24
24
  logstore, consumer_group, consumer, security_token=None, credentials_refresher=None,
25
- auth_version=AUTH_VERSION_1, region=''):
25
+ auth_version=AUTH_VERSION_1, region='',
26
+ accept_compress_type=None):
27
+ '''
28
+ :type endpoint: string
29
+ :param endpoint: the endpoint of sls project
26
30
 
31
+ :type access_key_id: string
32
+ :param access_key_id: your access key id
33
+
34
+ :type access_key: string
35
+ :param access_key: your access key secret
36
+
37
+ :type project: string
38
+ :param project: sls project
39
+
40
+ :type logstore: string
41
+ :param logstore: sls logstore to consume
42
+
43
+ :type consumer_group: string
44
+ :param consumer_group: consumer group name, the consumer group will be created when needed
45
+
46
+ :type consumer: string
47
+ :param consumer: consumer id, the id must be unique in the same consumer group
48
+
49
+ :type security_token: string
50
+ :param security_token: security token
51
+
52
+ :type credentials_refresher: CredentialsProvider
53
+ :param credentials_refresher: provides temporarily accessKeyId & accessKey dynamically
54
+
55
+ :type auth_version: string
56
+ :param auth_version: the auth version for signature, eg. AUTH_VERSION_1, AUTH_VERSION_4
57
+
58
+ :type region: string
59
+ :param region: the region of your project, required when auth_version is AUTH_VERSION_4
60
+
61
+ :type accept_compress_type: string
62
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
63
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
64
+
65
+ '''
27
66
  from .. import LogClient
28
67
 
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-%s' % (USER_AGENT, consumer_group, consumer))
68
+ self.mclient = LogClient(endpoint, access_key_id, access_key,
69
+ security_token, auth_version=auth_version, region=region)
70
+ self.mclient.set_user_agent(
71
+ '%s-consumergroup-%s-%s' % (USER_AGENT, consumer_group, consumer))
31
72
  if credentials_refresher is not None:
32
73
  self.mclient.set_credentials_auto_refresher(credentials_refresher)
33
74
  self.mproject = project
34
75
  self.mlogstore = logstore
35
76
  self.mconsumer_group = consumer_group
36
77
  self.mconsumer = consumer
78
+ self.accept_compress_type = accept_compress_type
37
79
  self.logger = ConsumerClientLoggerAdapter(
38
80
  logging.getLogger(__name__), {"consumer_client": self})
39
81
 
@@ -72,8 +114,8 @@ class ConsumerClient(object):
72
114
  except LogException as _:
73
115
  return None, True
74
116
 
75
-
76
117
  # fallback, for backward compatibility
118
+
77
119
  def _ensure_consumer_group_created_legacy(self, timeout, in_order):
78
120
  try:
79
121
  self.mclient.create_consumer_group(self.mproject, self.mlogstore, self.mconsumer_group,
@@ -138,4 +180,4 @@ class ConsumerClient(object):
138
180
  return self.mclient.get_end_cursor(self.mproject, self.mlogstore, shard_id).get_cursor()
139
181
 
140
182
  def pull_logs(self, shard_id, cursor, end_cursor=None, count=1000, query=None):
141
- return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor,query=query)
183
+ return self.mclient.pull_logs(self.mproject, self.mlogstore, shard_id, cursor, count, compress=True, end_cursor=end_cursor, query=query, accept_compress_type=self.accept_compress_type)
@@ -36,7 +36,8 @@ class ConsumerWorker(Thread):
36
36
  consumer_option.project, consumer_option.logstore, consumer_option.consumer_group_name,
37
37
  consumer_option.consumer_name, consumer_option.securityToken,
38
38
  credentials_refresher=consumer_option.credentials_refresher,
39
- auth_version=consumer_option.auth_version, region=consumer_option.region)
39
+ auth_version=consumer_option.auth_version, region=consumer_option.region,
40
+ accept_compress_type=consumer_option.accept_compress_type)
40
41
  self.shut_down_flag = False
41
42
  self.logger = ConsumerWorkerLoggerAdapter(
42
43
  logging.getLogger(__name__), {"consumer_worker": self})
@@ -1094,7 +1094,7 @@ class LogClient(object):
1094
1094
  """
1095
1095
  return self.get_cursor(project_name, logstore_name, shard_id, "end")
1096
1096
 
1097
- def pull_logs(self, project_name, logstore_name, shard_id, cursor, count=None, end_cursor=None, compress=None, query=None):
1097
+ def pull_logs(self, project_name, logstore_name, shard_id, cursor, count=None, end_cursor=None, compress=None, query=None, accept_compress_type=None):
1098
1098
  """ batch pull log data from log service
1099
1099
  Unsuccessful operation will cause an LogException.
1100
1100
 
@@ -1121,6 +1121,10 @@ class LogClient(object):
1121
1121
 
1122
1122
  :type query: string
1123
1123
  :param query: the SPL query, such as *| where a = 'xxx'
1124
+
1125
+ :type accept_compress_type: string
1126
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
1127
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
1124
1128
 
1125
1129
  :return: PullLogResponse
1126
1130
 
@@ -1131,7 +1135,10 @@ class LogClient(object):
1131
1135
 
1132
1136
  need_compress = compress is None or compress
1133
1137
  if need_compress:
1134
- headers['Accept-Encoding'] = str(CompressType.default_compress_type())
1138
+ if accept_compress_type is None or accept_compress_type == '':
1139
+ headers['Accept-Encoding'] = str(CompressType.default_compress_type())
1140
+ else:
1141
+ headers['Accept-Encoding'] = accept_compress_type
1135
1142
  else:
1136
1143
  headers['Accept-Encoding'] = ''
1137
1144
 
@@ -1158,7 +1165,7 @@ class LogClient(object):
1158
1165
  raw_data = Compressor.decompress_response(header, resp)
1159
1166
  return PullLogResponse(raw_data, header)
1160
1167
 
1161
- def pull_log(self, project_name, logstore_name, shard_id, from_time, to_time, batch_size=None, compress=None, query=None):
1168
+ def pull_log(self, project_name, logstore_name, shard_id, from_time, to_time, batch_size=None, compress=None, query=None, accept_compress_type=None):
1162
1169
  """ batch pull log data from log service using time-range
1163
1170
  Unsuccessful operation will cause an LogException. the time parameter means the time when server receives the logs
1164
1171
 
@@ -1185,6 +1192,10 @@ class LogClient(object):
1185
1192
 
1186
1193
  :type query: string
1187
1194
  :param query: the SPL query, such as *| where a = 'xxx'
1195
+
1196
+ :type accept_compress_type: string
1197
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
1198
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
1188
1199
 
1189
1200
  :return: PullLogResponse
1190
1201
 
@@ -1195,7 +1206,8 @@ class LogClient(object):
1195
1206
 
1196
1207
  while True:
1197
1208
  res = self.pull_logs(project_name, logstore_name, shard_id, begin_cursor,
1198
- count=batch_size, end_cursor=end_cursor, compress=compress, query=query)
1209
+ count=batch_size, end_cursor=end_cursor, compress=compress, query=query,
1210
+ accept_compress_type=accept_compress_type)
1199
1211
 
1200
1212
  yield res
1201
1213
  next_cursor = res.get_next_cursor()
@@ -1240,6 +1252,10 @@ class LogClient(object):
1240
1252
 
1241
1253
  :type query: string
1242
1254
  :param query: the SPL query, such as *| where a = 'xxx'
1255
+
1256
+ :type accept_compress_type: str
1257
+ :param accept_compress_type: The compression type used for logs retrieved from sls.
1258
+ Supported types include 'lz4' and 'zstd'. If you choose 'zstd', ensure the `zstd` library is installed via pip. The default value is 'lz4'.
1243
1259
 
1244
1260
  :return: LogResponse {"total_count": 30, "files": {'file_path_1': 10, "file_path_2": 20} })
1245
1261
 
@@ -1,4 +1,4 @@
1
- __version__ = '0.9.22'
1
+ __version__ = '0.9.23'
2
2
 
3
3
  import sys
4
4
  OS_VERSION = str(sys.platform)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: aliyun-log-python-sdk
3
- Version: 0.9.22
3
+ Version: 0.9.23
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