[求助] 程序报错:无效路径、JSON
xfrqh opened this issue · 1 comments
xfrqh commented
复现
按 阿里云云函数搭建说明 完成部署
发送请求
报错:{"code": -6, "msg": "invalid path info"}
将程序中的 if path_info == "/":
改为 if True:
来尝试跳过此问题。
再次发送相同请求
报错:{"code": -1, "msg": "invalid json input"}
日志
FC Invoke Start RequestId: 1-64dd3eef-ba945220b77ec629e29c7ed9
2023-08-17 05:26:07 1-64dd3eef-ba945220b77ec629e29c7ed9 [INFO] request body:
2023-08-17 05:26:07 1-64dd3eef-ba945220b77ec629e29c7ed9 [INFO] path_info: None
None
FC Invoke End RequestId: 1-64dd3eef-ba945220b77ec629e29c7ed9
按 PHP版搭建说明 完成部署
发送请求
# python
import requests
import json
url = "http://x.xxx:5039/"
headers = {
"Content-Type": "application/json"
}
data = {
"sendkey": "x",
"msg_type": "markdown",
"msg": "Markdown Here!"
}
response = requests.post(url, headers=headers, data=json.dumps(data))
if response.status_code == 200:
print("POST request sent successfully!")
print("Response:")
print(response.text)
else:
print("Failed to send POST request. Status code:", response.status_code)
回复:bad params
我的操作有问题吗,为什么会这样?
xfrqh commented