From 8ba1094f1782b488f96c097e88ffd26cff41bb56 Mon Sep 17 00:00:00 2001 From: orenzhang Date: Mon, 16 Dec 2024 18:47:56 +0800 Subject: [PATCH] fix(wxpay): sign api failed --- .gitignore | 1 + requirements.txt | 1 + utils/wxpay/utils.py | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9118d6d..f186a27 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ .test tmp .DS_Store +.vscode # Env .env diff --git a/requirements.txt b/requirements.txt index 9817856..d640e09 100644 --- a/requirements.txt +++ b/requirements.txt @@ -32,6 +32,7 @@ qcloud-python-sts==3.1.6 # qrcode qrcode==8.0.0 +pillow==11.0.0 # claude anthropic==0.40.0 diff --git a/utils/wxpay/utils.py b/utils/wxpay/utils.py index 089017d..79d2f6a 100644 --- a/utils/wxpay/utils.py +++ b/utils/wxpay/utils.py @@ -53,7 +53,7 @@ async def generate(cls, request_method: str, request_url: str, request_body: dic request_url=request_path, timestamp=timestamp, nonce=nonce, - request_body=json.dumps(request_body) if request_body else "", + request_body=json.dumps(request_body, ensure_ascii=False, separators=(",", ":")) if request_body else "", ) signature = trader_cert.private_key.sign( data=raw_info.encode("utf-8"),