Impl HTTP API

This commit is contained in:
Changhua
2023-04-03 12:24:18 +08:00
parent e96f3800e8
commit 891cada955
6 changed files with 86 additions and 2 deletions

View File

@@ -37,6 +37,13 @@ def main():
# 机器人启动发送测试消息
robot.sendTextMsg("机器人启动成功!", "filehelper")
# 暴露 HTTP 接口供发送消息,需要在配置文件中取消 http 注释
# 接口文档http://localhost:9999/docs
# 访问示例:
# 1. 浏览器访问http://localhost:9999/send?msg=hello%20world&receiver=filehelper
# 2. curl -X 'GET' 'http://localhost:9999/send?msg=hello%20world&receiver=filehelper' -H 'accept: application/json'
robot.enableHTTP()
# 接收消息
robot.enableRecvMsg()