FurFind 毛毛定位 · 接口调试
在本页算出签名并生成可直接运行的代码。Secret 只在你的浏览器内参与计算,不会上传、不会保存,刷新即清空。
选择接口
凭据与参数
Python 示例
import hashlib, hmac, time, uuid, requests
KEY_ID = "ffs_xxxxxxxx"
SECRET = "<你的 Secret>" # 不要硬编码进仓库,用环境变量
HOST = "https://furface.furryfans.cn"
PATH = "/v1/detect"
body = b'''{"imageUrl": "https://example.com/photo.jpg"}'''
ts = str(int(time.time()))
nonce = uuid.uuid4().hex[:16]
sts = "\n".join([
"POST", PATH, "", # 无 query 时第三段为空串
hashlib.sha256(body).hexdigest(),
ts, nonce,
])
sig = hmac.new(SECRET.encode(), sts.encode(), hashlib.sha256).hexdigest()
r = requests.post(HOST + PATH, data=body, headers={
"Content-Type": "application/json",
"X-Ffs-Key": KEY_ID,
"X-Ffs-Timestamp": ts,
"X-Ffs-Nonce": nonce,
"X-Ffs-Sign": sig,
})
print(r.json())完整的签名算法说明、错误码与其它语言示例见接入文档。当前接口:/v1/detect —— 只返回边界框与置信度