How to use before_request method in localstack

Best Python code snippet using localstack_python

bk_node.py

Source:bk_node.py Github

copy

Full Screen

1# -*- coding: utf-8 -*-2"""3TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-节点管理(BlueKing-BK-NODEMAN) available.4Copyright (C) 2017-2022 THL A29 Limited, a Tencent company. All rights reserved.5Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.6You may obtain a copy of the License at https://opensource.org/licenses/MIT7Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on8an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the9specific language governing permissions and limitations under the License.10"""11from django.utils.translation import ugettext_lazy as _12from ..base import DataAPI13from ..domains import BK_NODE_APIGATEWAY_ROOT14from .utils import add_esb_info_before_request15class _BKNodeApi(object):16 MODULE = _("节点管理")17 def __init__(self):18 self.upload = DataAPI(19 method="POST",20 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/upload/",21 module=self.MODULE,22 description="上传插件",23 before_request=add_esb_info_before_request,24 )25 self.create_subscription = DataAPI(26 method="POST",27 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/create/",28 module=self.MODULE,29 description="创建订阅配置",30 before_request=add_esb_info_before_request,31 )32 self.get_subscription_task_status = DataAPI(33 method="POST",34 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/task_result/",35 module=self.MODULE,36 description="查看订阅任务运行状态",37 before_request=add_esb_info_before_request,38 )39 self.collect_subscription_task_detail = DataAPI(40 method="POST",41 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/collect_task_result_detail/",42 module=self.MODULE,43 description="采集订阅任务中实例的详细状态",44 before_request=add_esb_info_before_request,45 )46 self.get_subscription_task_detail = DataAPI(47 method="POST",48 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/task_result_detail/",49 module=self.MODULE,50 description="查询订阅任务中实例的详细状态",51 before_request=add_esb_info_before_request,52 )53 self.check_subscription_task_ready = DataAPI(54 method="POST",55 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/check_task_ready/",56 module=self.MODULE,57 description="查询任务是否已准备完成",58 before_request=add_esb_info_before_request,59 )60 self.run_subscription_task = DataAPI(61 method="POST",62 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/run/",63 module=self.MODULE,64 description="执行订阅下发任务",65 before_request=add_esb_info_before_request,66 )67 self.subscription_delete = DataAPI(68 method="POST",69 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/delete/",70 module=self.MODULE,71 description="删除订阅",72 before_request=add_esb_info_before_request,73 )74 self.subscription_update = DataAPI(75 method="POST",76 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/update/",77 module=self.MODULE,78 description="更新订阅",79 before_request=add_esb_info_before_request,80 )81 self.subscription_info = DataAPI(82 method="POST",83 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/info/",84 module=self.MODULE,85 description="订阅详细",86 before_request=add_esb_info_before_request,87 )88 self.subscription_search_policy = DataAPI(89 method="POST",90 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/search_deploy_policy/",91 module=self.MODULE,92 description="查询策略列表",93 before_request=add_esb_info_before_request,94 )95 self.subscription_fetch_policy_topo = DataAPI(96 method="POST",97 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/fetch_policy_topo/",98 module=self.MODULE,99 description="插件策略拓扑",100 before_request=add_esb_info_before_request,101 )102 self.retry_subscription_task = DataAPI(103 method="POST",104 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/retry/",105 module=self.MODULE,106 description="重试任务",107 before_request=add_esb_info_before_request,108 )109 self.revoke_subscription_task = DataAPI(110 method="POST",111 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/revoke/",112 module=self.MODULE,113 description="终止正在执行的订阅任务",114 before_request=add_esb_info_before_request,115 )116 self.fetch_commands = DataAPI(117 method="POST",118 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/fetch_commands/",119 module=self.MODULE,120 description="获取安装命令",121 before_request=add_esb_info_before_request,122 )123 self.retry_node = DataAPI(124 method="POST",125 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/retry_node/",126 module=self.MODULE,127 description="原子粒度重试任务",128 before_request=add_esb_info_before_request,129 )130 # 插件包接口131 self.create_register_task = DataAPI(132 method="POST",133 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/create_register_task/",134 module=self.MODULE,135 description="创建注册任务",136 before_request=add_esb_info_before_request,137 )138 self.query_register_task = DataAPI(139 method="GET",140 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/query_register_task/",141 module=self.MODULE,142 description="查询插件注册任务",143 before_request=add_esb_info_before_request,144 )145 self.release = DataAPI(146 method="POST",147 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/release/",148 module=self.MODULE,149 description="发布(上线)插件包",150 before_request=add_esb_info_before_request,151 )152 self.package_status_operation = DataAPI(153 method="POST",154 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/package_status_operation/",155 module=self.MODULE,156 description="插件包状态类操作",157 before_request=add_esb_info_before_request,158 )159 self.create_export_task = DataAPI(160 method="POST",161 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/create_export_task/",162 module=self.MODULE,163 description="触发插件打包导出",164 before_request=add_esb_info_before_request,165 )166 self.query_export_task = DataAPI(167 method="GET",168 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/query_export_task/",169 module=self.MODULE,170 description="获取一个导出任务结果",171 before_request=add_esb_info_before_request,172 )173 self.parse = DataAPI(174 method="POST",175 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/parse/",176 module=self.MODULE,177 description="解析插件包",178 before_request=add_esb_info_before_request,179 )180 self.plugin_list = DataAPI(181 method="GET",182 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/",183 module=self.MODULE,184 description="插件列表",185 before_request=add_esb_info_before_request,186 )187 self.plugin_retrieve = DataAPI(188 method="GET",189 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/{plugin_id}/",190 module=self.MODULE,191 description="插件详细",192 before_request=add_esb_info_before_request,193 )194 self.plugin_status_operation = DataAPI(195 method="POST",196 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/plugin_status_operation/",197 module=self.MODULE,198 description="插件状态类操作",199 before_request=add_esb_info_before_request,200 )201 self.plugin_history = DataAPI(202 method="GET",203 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/plugin/{plugin_id}/history/",204 module=self.MODULE,205 description="插件包历史",206 before_request=add_esb_info_before_request,207 )208 self.query_host_policy = DataAPI(209 method="GET",210 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/query_host_policy/",211 module=self.MODULE,212 description="主机策略列表",213 before_request=add_esb_info_before_request,214 )215 self.migrate_preview = DataAPI(216 method="POST",217 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/subscription/migrate_preview/",218 module=self.MODULE,219 description="变更计算预览",220 before_request=add_esb_info_before_request,221 )222 self.metric_list = DataAPI(223 method="GET",224 url=BK_NODE_APIGATEWAY_ROOT + "backend/api/healthz/",225 module=self.MODULE,226 description="自监控指标检查",227 before_request=add_esb_info_before_request,...

Full Screen

Full Screen

__init__.py

Source:__init__.py Github

copy

Full Screen

...9from API.database import database as dbBlueprint10from API.login_log import login_log as logBlueprint11from API.auth import token_auth12@token_auth13def before_request():14 pass15# token_auth 视图16userBlueprint.before_request(before_request)17arctypeBlueprint.before_request(before_request)18archiveBlueprint.before_request(before_request)19commentBlueprint.before_request(before_request)20configBlueprint.before_request(before_request)21dbBlueprint.before_request(before_request)...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run localstack automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful