https://openapi.xydc.com
{
"client_id": "your16charclientid",
"client_secret": "your24charclientsecret"
}
签名 = SHA256(client_id + timestamp + client_secret + request_body)
signature = sha256(sign_str).hexdigest()
参数说明:
client_id: 与 X-Client-Id 相同
timestamp: 与 X-Timestamp 相同(秒级 UNIX 时间戳)
client_secret: 分配给调用方的密钥(务必妥善保管)
request_body: 与实际请求体完全一致的字符串
若为 JSON,请进行“有序序列化”:键名按字典序升序、无多余空格,序列化等价于 Python 的 json.dumps(obj, separators=(',', ':'), sort_keys=True)
若无请求体(如 GET),则置为空字符串 ""
X-Client-Id | string | 是 | 您的16位Client ID |X-Timestamp | string | 是 | 当前时间戳(秒级,10位数字) |X-Sign | string | 是 | 计算得出的签名(小写十六进制) |Content-Type | string | 是 | 固定值:application/json |
pip3 install xiyou-sdk
{
"code": 400,
"reason": "InvalidClientId",
"message": "invalid client id: must be exactly 16 characters",
"metadata": {}
}
code | int | 是 | 返回的http状态吗 |reason | string | 是 | 返回的业务错误码 |message | string | 是 | 返回的错误信息 |metadata | map | 是 | 返回的错误详细信息 |