From f4d278eae4bcb259a966b9a03bba2dd41ed39f04 Mon Sep 17 00:00:00 2001 From: GinHa <15201596918@163.com> Date: Mon, 6 Jul 2026 15:58:50 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9C=9F=E4=BA=BA=E7=B4=A0=E6=9D=90=E5=BA=93?= =?UTF-8?q?=E6=8E=88=E6=9D=83BUG=E4=BF=AE=E5=A4=8D=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- video-gen-api/app/services/private_portrait/ark_client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/video-gen-api/app/services/private_portrait/ark_client.py b/video-gen-api/app/services/private_portrait/ark_client.py index e5ce0463..c2078a1d 100644 --- a/video-gen-api/app/services/private_portrait/ark_client.py +++ b/video-gen-api/app/services/private_portrait/ark_client.py @@ -149,7 +149,11 @@ class ArkPrivateAssetClient: ) } service = Service(service_info, api_info) - raw = service.json(action.value, {}, payload) + + # volcengine SDK 在签名阶段会对 request.body 做 hashlib.sha256(body)。 + # Python 3 下 hashlib.sha256 只能接收 bytes/bytearray,不能接收 dict 或 str。 + body = json.dumps(payload, ensure_ascii=False, separators=(",", ":")).encode("utf-8") + raw = service.json(action.value, {}, body) resp = self._normalize_response(raw) metadata = resp.get("ResponseMetadata") if isinstance(resp, dict) else None