API接口文档
2026-04-18 14:52:52 1027
获取密钥
本篇介绍如何使用第三方程序来调用搜题API接口,接口地址均使用: https://api.top2189.cn 。
首先获取你的sign密钥,作为调用API接口的凭证。
相关接口
搜题接口
接口地址:/api/search
支持方法:POST / GET
请求参数:
| 字段 | 说明 | 类型 | 必填 |
| question | 需要搜索的问题 | String | 是 |
| sign | 接口密钥 | String | 是 |
示例代码:
import requests
api = 'https://api.top2189.cn/api/search'
data = requests.post(
api,
data = {
'question': '《谁来养活中国?》一文的作者是()。',
'sign': 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
}).json()
print(data)
成功响应:
{
"code": 200,
"data": [
{
"answer": "莱斯特.布朗",
"nums": 9,
"question": "《谁来养活中国?》一文的作者是()。",
"similarity": 1.0
},
{
"answer": "王明",
"nums": 2,
"question": "《道教和道家思想研究》一文的作者是()。C",
"similarity": 0.4444
}
],
"msg": "success",
"num": 3336,
"nums": 2,
"time": 0.853,
"usenum": 7863
}