更新时间:2025-11-21 GMT+08:00
创建B1连接器
步骤1 登录集成工作台-连接器-我的连接器-创建我的连接器
采用自定义认证,使用函数,创建函数。

编辑源码,输入Python代码。
- import requests
- from requests.packages.urllib3.exceptions import InsecureRequestWarning
- requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
- def login(body):
- base = 'https://api.myhuaweicloud.com/xxx/' # change it
- url = base + '/b1s/v1/Login'
- headers = {'Content-Type': 'application/json'}
- session = requests.Session()
- session.post(url, json=body, headers=headers)
- _cookies = []
- for k, v in session.cookies.get_dict().items():
- _cookies.append(k + "=" + v)
- return {'Cookie': ';'.join(_cookies)}
- def main(inputData):
- body = {
- "CompanyDB": inputData["CompanyDB"],
- "UserName": inputData["UserName"],
- "Password": inputData["Password"]
- }
- result = login(body)
- return result
连接器配置如下。

父主题: 创建到B1连接器并封装连接