bk-resource 0.4.10__py3-none-any.whl → 0.4.11b0__py3-none-any.whl
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.
- bk_resource/tasks.py +2 -2
- bk_resource/viewsets.py +4 -4
- {bk_resource-0.4.10.dist-info → bk_resource-0.4.11b0.dist-info}/METADATA +4 -4
- {bk_resource-0.4.10.dist-info → bk_resource-0.4.11b0.dist-info}/RECORD +7 -7
- {bk_resource-0.4.10.dist-info → bk_resource-0.4.11b0.dist-info}/WHEEL +1 -1
- {bk_resource-0.4.10.dist-info → bk_resource-0.4.11b0.dist-info}/LICENSE.txt +0 -0
- {bk_resource-0.4.10.dist-info → bk_resource-0.4.11b0.dist-info}/top_level.txt +0 -0
bk_resource/tasks.py
CHANGED
@@ -18,8 +18,8 @@ to the current version of the project delivered to anyone in the future.
|
|
18
18
|
|
19
19
|
from functools import wraps
|
20
20
|
|
21
|
+
from blueapps.core.celery import celery_app
|
21
22
|
from celery.result import AsyncResult
|
22
|
-
from celery.task import task
|
23
23
|
from django.utils.module_loading import import_string
|
24
24
|
|
25
25
|
from bk_resource.exceptions import CustomError
|
@@ -27,7 +27,7 @@ from bk_resource.utils.logger import logger
|
|
27
27
|
from bk_resource.utils.request import set_local_username
|
28
28
|
|
29
29
|
|
30
|
-
@task(bind=True)
|
30
|
+
@celery_app.task(bind=True)
|
31
31
|
def run_perform_request(self, resource_obj, username, request_data):
|
32
32
|
"""
|
33
33
|
将resource作为异步任务执行
|
bk_resource/viewsets.py
CHANGED
@@ -51,7 +51,7 @@ class ResourceRoute(object):
|
|
51
51
|
decorators=None,
|
52
52
|
):
|
53
53
|
"""
|
54
|
-
:param method:
|
54
|
+
:param method: 请求方法,目前支持GET, POST, PUT, PATCH, DELETE
|
55
55
|
:param resource_class: 所用到的Resource类
|
56
56
|
:param endpoint: 端点名称,不提供则为list或create
|
57
57
|
:param pk_field: 主键名称,如果不为空,则该视图为 detail route
|
@@ -59,8 +59,6 @@ class ResourceRoute(object):
|
|
59
59
|
:param content_encoding: 返回数据内容编码类型
|
60
60
|
:params decorators: 给view_func添加的装饰器列表
|
61
61
|
"""
|
62
|
-
# if method.upper() not in ["GET", "POST"]:
|
63
|
-
# raise ValueError(_("method参数错误,目前仅支持GET或POST方法"))
|
64
62
|
|
65
63
|
self.method = method.upper()
|
66
64
|
|
@@ -167,7 +165,9 @@ class ResourceViewSet(viewsets.GenericViewSet):
|
|
167
165
|
500: bk_resource_settings.DEFAULT_ERROR_RESPONSE_SERIALIZER,
|
168
166
|
},
|
169
167
|
operation_description=resource_route.resource_class.__doc__,
|
170
|
-
request_body=request_serializer
|
168
|
+
request_body=request_serializer
|
169
|
+
if resource_route.method in ["POST", "PUT", "PATCH", "DELETE"]
|
170
|
+
else None,
|
171
171
|
query_serializer=request_serializer if resource_route.method == "GET" else None,
|
172
172
|
operation_summary=getattr(resource_route.resource_class, "name", None),
|
173
173
|
tags=getattr(resource_route.resource_class, "tags", None),
|
@@ -1,25 +1,25 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: bk_resource
|
3
|
-
Version: 0.4.
|
3
|
+
Version: 0.4.11b0
|
4
4
|
Summary: Bk Resource
|
5
5
|
Home-page: https://bk.tencent.com
|
6
6
|
Author: blueking
|
7
7
|
Author-email: blueking@tencent.com
|
8
8
|
Description-Content-Type: text/markdown
|
9
9
|
License-File: LICENSE.txt
|
10
|
-
Requires-Dist: blueapps
|
10
|
+
Requires-Dist: blueapps >=4.12.0
|
11
11
|
Requires-Dist: django >=3.2.18
|
12
12
|
Requires-Dist: djangorestframework >=3.12.0
|
13
13
|
Requires-Dist: drf-yasg >=1.20.0
|
14
14
|
Requires-Dist: pyinstrument >=3.4.2
|
15
15
|
Requires-Dist: arrow >=1.2.0
|
16
16
|
Requires-Dist: django-rest-framework-condition >=0.1.1
|
17
|
-
Requires-Dist: celery
|
17
|
+
Requires-Dist: celery >=5
|
18
18
|
|
19
19
|

|
20
20
|
|
21
21
|
[](https://github.com/TencentBlueKing/bk-resource/blob/main/LICENSE.txt)
|
22
|
-
[](https://github.com/TencentBlueKing/bk-resource/releases)
|
23
23
|
[](https://github.com/TencentBlueKing/bk-resource/pulls)
|
24
24
|
[](https://codecov.io/gh/TencentBlueKing/bk-resource)
|
25
25
|
[](https://github.com/TencentBlueKing/bk-resource/actions/workflows/unittest.yml)
|
@@ -5,9 +5,9 @@ bk_resource/exceptions.py,sha256=lrO1pHGzy8P0AvdCYMk1SR-qKCy-bbPNapZcINBw9c0,388
|
|
5
5
|
bk_resource/routers.py,sha256=IrMurTJXlxyo8IIjMx9w0iOvagB6rORmZlZFtAwFxr8,2516
|
6
6
|
bk_resource/serializers.py,sha256=Az_2Qsp_5gUrhU_0iZS45komm5upU5u1UpNE-ArSX4s,2690
|
7
7
|
bk_resource/settings.py,sha256=QCGKeetjdDIWHHu1_93MKPeJ_VpGlQXvW7gpln1pGlU,3827
|
8
|
-
bk_resource/tasks.py,sha256=
|
8
|
+
bk_resource/tasks.py,sha256=OeBy41GfSDNL_0adGeKBG6LlVRqNUfP7KzXe7pxpr3I,4090
|
9
9
|
bk_resource/tools.py,sha256=fPmiDNxh2FWo5Yo7CXtvYyHxyG3_JrGs5wYZMaVFAhE,8166
|
10
|
-
bk_resource/viewsets.py,sha256
|
10
|
+
bk_resource/viewsets.py,sha256=QhCIHiJ227N8njqr6bSJZxP5eBh3z5Q4u1dGzBjHHXs,11614
|
11
11
|
bk_resource/conf/__init__.py,sha256=39m-gTk6pr0j_6xwdfTFEFuj_ER_MDoEll2zkEdCPBo,891
|
12
12
|
bk_resource/conf/app_template/__init__.py-tpl,sha256=iwhKnzeBJLKxpRVjvzwiRE63_zNpIBfaKLITauVph-0,24
|
13
13
|
bk_resource/conf/app_template/admin.py-tpl,sha256=n0NQrWDbx74lHja8g2s5vTKjR954SCtizSehZCQLBK0,60
|
@@ -48,8 +48,8 @@ bk_resource/utils/request_log.py,sha256=VMSFu0c8e53e7TUFJtdKXpkM0_pl-mk1UaFFdrGY
|
|
48
48
|
bk_resource/utils/text.py,sha256=exu7gEFANcU6apQOut_1VSzoddOvcKR3CXEF1Z19M4Y,3313
|
49
49
|
bk_resource/utils/thread_backend.py,sha256=AdMWzXreFARinPdDaMiRJwwxSWL1EB4MUSz1Q7kYz90,5017
|
50
50
|
bk_resource/utils/time_tools.py,sha256=y-eP-6Gu5ur3ET0bOp2ML8Z0HtrguvTPlbsSA1dNhWU,10967
|
51
|
-
bk_resource-0.4.
|
52
|
-
bk_resource-0.4.
|
53
|
-
bk_resource-0.4.
|
54
|
-
bk_resource-0.4.
|
55
|
-
bk_resource-0.4.
|
51
|
+
bk_resource-0.4.11b0.dist-info/LICENSE.txt,sha256=dnlkOMrlbRgRXlBt-a_QF6cs1MFG6WYmcotYbI6_gpo,859
|
52
|
+
bk_resource-0.4.11b0.dist-info/METADATA,sha256=hK2bY984uT4XvPbbb2a6R6Jd0sIeR3AFbUuPM0xiEqU,5499
|
53
|
+
bk_resource-0.4.11b0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
54
|
+
bk_resource-0.4.11b0.dist-info/top_level.txt,sha256=UJxO1tbrqlmnvSTYCLoqg39_gvBesvjp3CcGEPjzXY4,12
|
55
|
+
bk_resource-0.4.11b0.dist-info/RECORD,,
|
File without changes
|
File without changes
|