Skip to content

Commit dd4bcb9

Browse files
authored
Merge branch 'master' into sls-pb-go-util
2 parents 43b299f + 775a06b commit dd4bcb9

File tree

9 files changed

+55
-18
lines changed

9 files changed

+55
-18
lines changed

alibabacloud-gateway-sls/Teafile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"releases": {
2525
"ts": "@alicloud/gateway-sls:^0.3.0",
2626
"go": "github.com/alibabacloud-go/alibabacloud-gateway-sls/client:v0.3.0",
27-
"java": "com.aliyun:alibabacloud-gateway-sls:0.3.0",
28-
"python": "alibabacloud_gateway_sls:0.3.0",
27+
"java": "com.aliyun:alibabacloud-gateway-sls:0.4.0",
28+
"python": "alibabacloud_gateway_sls:0.4.0",
2929
"python2": "alibabacloud_gateway_sls_py2:0.0.6",
3030
"csharp": "AlibabaCloud.GatewaySls:0.3.0",
3131
"php": "alibabacloud/gateway-sls:^0.3.0"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.2"
1+
__version__ = "0.4.0"

alibabacloud-gateway-sls/python/alibabacloud_gateway_sls/client.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717

1818

1919
class Client(SPIClient):
20+
2021
def __init__(self):
2122
super().__init__()
2223
self._resp_body_decompress_type = {
@@ -85,7 +86,11 @@ def modify_request(
8586
# get body bytes
8687
body_bytes = None
8788
if not UtilClient.is_unset(request.body):
88-
if StringClient.equals(request.req_body_type, 'json') or StringClient.equals(request.req_body_type, 'formData'):
89+
# PutLogs
90+
if StringClient.equals(request.action, 'PutLogs'):
91+
body_bytes = SLS_UtilClient.serialize_log_group_to_pb(request.body)
92+
request.headers['content-type'] = 'application/x-protobuf'
93+
elif StringClient.equals(request.req_body_type, 'json') or StringClient.equals(request.req_body_type, 'formData'):
8994
request.headers['content-type'] = 'application/json'
9095
body_str = UtilClient.to_jsonstring(request.body)
9196
body_bytes = UtilClient.to_bytes(body_str)
@@ -156,7 +161,11 @@ async def modify_request_async(
156161
# get body bytes
157162
body_bytes = None
158163
if not UtilClient.is_unset(request.body):
159-
if StringClient.equals(request.req_body_type, 'json') or StringClient.equals(request.req_body_type, 'formData'):
164+
# PutLogs
165+
if StringClient.equals(request.action, 'PutLogs'):
166+
body_bytes = await SLS_UtilClient.serialize_log_group_to_pb_async(request.body)
167+
request.headers['content-type'] = 'application/x-protobuf'
168+
elif StringClient.equals(request.req_body_type, 'json') or StringClient.equals(request.req_body_type, 'formData'):
160169
request.headers['content-type'] = 'application/json'
161170
body_str = UtilClient.to_jsonstring(request.body)
162171
body_bytes = UtilClient.to_bytes(body_str)

alibabacloud-gateway-sls/python/setup.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525
setup module for alibabacloud_gateway_sls.
2626
27-
Created on 20/11/2024
27+
Created on 18/11/2025
2828
2929
@author: Alibaba Cloud SDK
3030
"""
@@ -38,15 +38,15 @@
3838
VERSION = __import__(PACKAGE).__version__
3939
REQUIRES = [
4040
"alibabacloud_gateway_spi>=0.0.2, <1.0.0",
41-
"alibabacloud_credentials>=0.3.5",
41+
"alibabacloud_credentials>=1.0.2, <2.0.0",
4242
"alibabacloud_tea_util>=0.3.13, <1.0.0",
43-
"alibabacloud_openapi_util>=0.2.1, <1.0.0",
43+
"alibabacloud_openapi_util>=0.2.2, <1.0.0",
4444
"alibabacloud_darabonba_string>=0.0.4, <1.0.0",
4545
"alibabacloud_darabonba_map>=0.0.1, <1.0.0",
4646
"alibabacloud_darabonba_array>=0.1.0, <1.0.0",
4747
"alibabacloud_darabonba_encode_util>=0.0.2, <1.0.0",
4848
"alibabacloud_darabonba_signature_util>=0.0.4, <1.0.0",
49-
"alibabacloud_gateway_sls_util>=0.3.1, <1.0.0"
49+
"alibabacloud_gateway_sls_util>=0.4.0, <1.0.0"
5050
]
5151

5252
LONG_DESCRIPTION = ''
@@ -69,17 +69,19 @@
6969
include_package_data=True,
7070
platforms="any",
7171
install_requires=REQUIRES,
72-
python_requires=">=3.6",
72+
python_requires=">=3.7",
7373
classifiers=(
7474
"Development Status :: 4 - Beta",
7575
"Intended Audience :: Developers",
7676
"License :: OSI Approved :: Apache Software License",
7777
"Programming Language :: Python",
7878
"Programming Language :: Python :: 3",
79-
"Programming Language :: Python :: 3.6",
8079
'Programming Language :: Python :: 3.7',
8180
'Programming Language :: Python :: 3.8',
8281
'Programming Language :: Python :: 3.9',
82+
'Programming Language :: Python :: 3.10',
83+
'Programming Language :: Python :: 3.11',
84+
'Programming Language :: Python :: 3.12',
8385
"Topic :: Software Development"
8486
)
8587
)

alibabacloud-gateway-sls/util/Teafile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"ts": "@alicloud/gateway-sls-util:^0.3.0",
1717
"go": "github.com/alibabacloud-go/alibabacloud-gateway-sls-util/client:v0.4.0",
1818
"java": "com.aliyun:alibabacloud-gateway-sls-util:0.4.0",
19-
"python": "alibabacloud_gateway_sls_util:0.3.0",
19+
"python": "alibabacloud_gateway_sls_util:0.4.0",
2020
"python2": "alibabacloud_gateway_sls_util_py2:0.0.1",
2121
"csharp": "AlibabaCloud.GatewaySls_Util:0.3.0",
2222
"php": "alibabacloud/gateway-sls-util:^0.3.0"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.3.1"
1+
__version__ = "0.4.0"

alibabacloud-gateway-sls/util/python/alibabacloud_gateway_sls_util/client.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# -*- coding: utf-8 -*-
22
# This file is auto-generated, don't edit it. Thanks.
3-
from typing import BinaryIO, List
3+
from typing import BinaryIO, List, Any
44
import lz4.block
55
import zlib
66
import zstd
77
import io
8+
from .log_group_serializer import serialize_log_group_to_pb
89

910
# for compressor
1011
supported_compress_types = ['lz4', 'zstd', 'gzip', 'deflate']
@@ -177,3 +178,15 @@ async def bytes_length_async(
177178
src: bytes,
178179
) -> int:
179180
return len(src)
181+
182+
@staticmethod
183+
def serialize_log_group_to_pb(
184+
log_group: Any,
185+
) -> bytes:
186+
return serialize_log_group_to_pb(log_group)
187+
188+
@staticmethod
189+
async def serialize_log_group_to_pb_async(
190+
log_group: Any,
191+
) -> bytes:
192+
return serialize_log_group_to_pb(log_group)
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from typing import Any
2+
from aliyun_log_fastpb import serialize_log_group
3+
4+
5+
def serialize_log_group_to_pb(log_group: Any) -> bytes:
6+
if log_group is None:
7+
raise ValueError("log_group is None")
8+
if not isinstance(log_group, dict):
9+
raise ValueError("log_group is not a dict")
10+
return serialize_log_group(log_group)

alibabacloud-gateway-sls/util/python/setup.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"""
2525
setup module for alibabacloud_gateway_sls_util.
2626
27-
Created on 02/06/2023
27+
Created on 14/11/2025
2828
2929
@author: Alibaba Cloud SDK
3030
"""
@@ -38,7 +38,8 @@
3838
VERSION = __import__(PACKAGE).__version__
3939
REQUIRES = [
4040
"lz4>=4.3.2",
41-
"zstd>=1.5.5.1"
41+
"zstd>=1.5.5.1",
42+
"aliyun-log-fastpb>=0.2.0"
4243
]
4344

4445
LONG_DESCRIPTION = ''
@@ -61,17 +62,19 @@
6162
include_package_data=True,
6263
platforms="any",
6364
install_requires=REQUIRES,
64-
python_requires=">=3.6",
65+
python_requires=">=3.7",
6566
classifiers=(
6667
"Development Status :: 4 - Beta",
6768
"Intended Audience :: Developers",
6869
"License :: OSI Approved :: Apache Software License",
6970
"Programming Language :: Python",
7071
"Programming Language :: Python :: 3",
71-
"Programming Language :: Python :: 3.6",
7272
'Programming Language :: Python :: 3.7',
7373
'Programming Language :: Python :: 3.8',
7474
'Programming Language :: Python :: 3.9',
75+
'Programming Language :: Python :: 3.10',
76+
'Programming Language :: Python :: 3.11',
77+
'Programming Language :: Python :: 3.12',
7578
"Topic :: Software Development"
7679
)
7780
)

0 commit comments

Comments
 (0)