为什么我curl会返回{"detail":"Not Found"} ? #1806
Answered
by
dongguaguaguagua
dongguaguaguagua
asked this question in
Q&A
-
问题
❯ curl http://127.0.0.1:5731/
{"detail":"Not Found"}%
希望得到的结果来自#1670 信息❯ sudo ./go-cqhttp
[2022-12-18 12:12:55] [INFO]: 当前版本:v1.0.0-rc2
[2022-12-18 12:12:55] [INFO]: 将使用 device.json 内的设备信息运行Bot.
[2022-12-18 12:12:55] [INFO]: Bot将在5秒后登录并开始信息处理, 按 Ctrl+C 取消.
[2022-12-18 12:13:00] [INFO]: 开始尝试登录并同步消息...
[2022-12-18 12:13:00] [INFO]: 使用协议: iPad
[2022-12-18 12:13:06] [INFO]: Protocol -> connect to server: 106.55.127.172:8080
[2022-12-18 12:13:07] [WARNING]: Protocol -> device lock is disable. http api may fail.
[2022-12-18 12:13:09] [INFO]: 登录成功 欢迎使用: chatbot
[2022-12-18 12:13:09] [INFO]: 开始加载好友列表...
[2022-12-18 12:13:09] [INFO]: 共加载 5 个好友.
[2022-12-18 12:13:09] [INFO]: 开始加载群列表...
[2022-12-18 12:13:10] [INFO]: 共加载 1 个群.
[2022-12-18 12:13:10] [INFO]: 资源初始化完成, 开始处理信息.
[2022-12-18 12:13:10] [INFO]: アトリは、高性能ですから!
[2022-12-18 12:13:10] [INFO]: 开始尝试连接到反向WebSocket Universal服务器: ws://127.0.0.1:5731/onebot/v11/ws/
[2022-12-18 12:13:10] [INFO]: 正在检查更新.
[2022-12-18 12:13:10] [INFO]: 已连接到反向WebSocket Universal服务器 ws://127.0.0.1:5731/onebot/v11/ws/
[2022-12-18 12:13:10] [INFO]: 当前有更新的 go-cqhttp 可供更新, 请前往 https://github.com/Mrs4s/go-cqhttp/releases 下载.
[2022-12-18 12:13:10] [INFO]: 当前版本: v1.0.0-rc2 最新版本: v1.0.0-rc3
[2022-12-18 12:13:10] [INFO]: 开始诊断网络情况
[2022-12-18 12:13:14] [INFO]: 网络诊断完成. 未发现问题 ❯ nb run
12-18 12:12:53 [SUCCESS] nonebot | NoneBot is initializing...
12-18 12:12:53 [INFO] nonebot | Current Env: dev
12-18 12:12:53 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 5731, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': {'2$$$536263'}, 'nickname': {'bot', 'chatbot'}, 'command_start': {'', '.'}, 'command_sep': {'/'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'openai_organization': 'org-WvMRPik8NGGoWxdJf9QPwpkh', 'openai_api_key': 'sk-hV$$$$$$ZjgFH7agADK2t4T$$$$$$$$$$8', 'environment': 'dev', 'fastapi_reload': True}
12-18 12:12:53 [DEBUG] nonebot | Succeeded to load adapter "OneBot V11"
12-18 12:12:53 [SUCCESS] nonebot | Succeeded to import "chat"
12-18 12:12:53 [SUCCESS] nonebot | Succeeded to import "qqcard"
12-18 12:12:53 [SUCCESS] nonebot | Running NoneBot...
12-18 12:12:53 [DEBUG] nonebot | Loaded adapters: OneBot V11
12-18 12:12:53 [INFO] uvicorn | Will watch for changes in these directories: ['/Users/$$$/PycharmProjects/nonebot2/qq-chatGPT']
12-18 12:12:53 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:5731 (Press CTRL+C to quit)
12-18 12:12:53 [INFO] uvicorn | Started reloader process [6299] using WatchFiles
12-18 12:12:54 [SUCCESS] nonebot | NoneBot is initializing...
12-18 12:12:54 [INFO] nonebot | Current Env: dev
12-18 12:12:54 [DEBUG] nonebot | Loaded Config: {'driver': '~fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 5731, 'log_level': 'DEBUG', 'api_timeout': 30.0, 'superusers': {'2$$$536263'}, 'nickname': {'chatbot', 'bot'}, 'command_start': {'', '.'}, 'command_sep': {'/'}, 'session_expire_timeout': datetime.timedelta(seconds=120), 'environment': 'dev', 'fastapi_reload': True, 'openai_organization': 'org-WvMRPik8NGGoWxdJf9QPwpkh', 'openai_api_key': 'sk-hV$$$$$$ZjgFH7agADK2t4T$$$$$$$$$$8'}
12-18 12:12:54 [DEBUG] nonebot | Succeeded to load adapter "OneBot V11"
12-18 12:12:54 [SUCCESS] nonebot | Succeeded to import "chat"
12-18 12:12:54 [SUCCESS] nonebot | Succeeded to import "qqcard"
12-18 12:12:54 [INFO] uvicorn | Started server process [6301]
12-18 12:12:54 [INFO] uvicorn | Waiting for application startup.
12-18 12:12:54 [INFO] uvicorn | Application startup complete.
12-18 12:13:10 [INFO] uvicorn | ('127.0.0.1', 60811) - "WebSocket /onebot/v11/ws/" [accepted]
12-18 12:13:10 [INFO] nonebot | OneBot V11 | Bot 3$$$$$0965 connected
12-18 12:13:10 [INFO] websockets | connection open curl 失败后,nb会输出奇怪的get请求: ❯ curl http://127.0.0.1:5731/
{"detail":"Not Found"}%
❯ curl http://127.0.0.1:5731/
{"detail":"Not Found"}%
❯ curl http://127.0.0.1:5731/
{"detail":"Not Found"}%
❯ curl http://127.0.0.1:5731/
{"detail":"Not Found"}%
❯ curl http://127.0.0.1:5731/
{"detail":"Not Found"}% 12-18 12:13:25 [INFO] uvicorn | 127.0.0.1:60895 - "GET / HTTP/1.1" 404
12-18 12:15:39 [INFO] uvicorn | 127.0.0.1:60942 - "GET / HTTP/1.1" 404
12-18 12:28:06 [INFO] uvicorn | 127.0.0.1:61066 - "GET / HTTP/1.1" 404
12-18 12:28:11 [INFO] uvicorn | 127.0.0.1:61067 - "GET / HTTP/1.1" 404
12-18 12:28:18 [INFO] uvicorn | 127.0.0.1:61068 - "GET / HTTP/1.1" 404 每次的端口还不一样 |
Beta Was this translation helpful? Give feedback.
Answered by
dongguaguaguagua
Dec 20, 2022
Replies: 1 comment
-
解决了,我是傻呗。 在 servers:
- http: # HTTP 通信设置
address: 0.0.0.0:5700 # HTTP监听地址
timeout: 5 # 反向 HTTP 超时时间, 单位秒,<5 时将被忽略
long-polling: # 长轮询拓展
enabled: false # 是否开启
max-queue-size: 2000 # 消息队列大小,0 表示不限制队列大小,谨慎使用
middlewares:
<<: *default # 引用默认中间件
post: # 反向HTTP POST地址列表
#- url: '' # 地址
# secret: '' # 密钥
# max-retries: 3 # 最大重试,0 时禁用
# retries-interval: 1500 # 重试时间,单位毫秒,0 时立即
#- url: http://127.0.0.1:5701/ # 地址
# secret: '' # 密钥
# max-retries: 10 # 最大重试,0 时禁用
# retries-interval: 1000 # 重试时间,单位毫秒,0 时立即 重启go-cqhttp就能通过127.0.0.1:5700获取数据了。 ❯ curl http://127.0.0.1:5700
{"data":null,"msg":"API_NOT_FOUND","retcode":404,"status":"failed","wording":"API不存在"} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dongguaguaguagua
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
解决了,我是傻呗。
在
config.yaml
里面的server里面加上: