new file: .vscode/settings.json

modified:   app.py
This commit is contained in:
IrisVega 2024-05-19 20:31:15 +08:00
parent 595c204918
commit cfcde16e95
2 changed files with 21 additions and 5 deletions

20
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,20 @@
{
"MicroPython.executeButton": [
{
"text": "▶",
"tooltip": "运行",
"alignment": "left",
"command": "extension.executeFile",
"priority": 3.5
}
],
"MicroPython.syncButton": [
{
"text": "$(sync)",
"tooltip": "同步",
"alignment": "left",
"command": "extension.execute",
"priority": 4
}
]
}

6
app.py
View File

@ -21,7 +21,7 @@ def send_custom_json(ida):
"nonce": nonce
},
"params": {
"token": "At_0000hz7d3dcf1dbd884b4ba94a26c621",
"token": "At_0000hz6cc6b1e0444c4b848d5ad85927",
"deviceId": "9F01FD3PAZ9B6B4",
"channelId": "0",
"operation": ida,
@ -32,16 +32,12 @@ def send_custom_json(ida):
target_url = 'https://openapi.lechange.cn:443/openapi/controlMovePTZ'
headers = {'Content-Type': 'application/json'}
try:
# 将自定义JSON数据转换为字符串
json_payload = json.dumps(custom_json)
# 发送POST请求到外部API
response = requests.post(target_url, data=json_payload, headers=headers)
# 检查请求是否成功
if response.status_code == 200:
print('Request sent successfully')
# 返回目标API的响应给客户端
return jsonify(response.json())
else:
print(f'Failed to send request, status code: {response.status_code}')