Skip to content

Commit edab888

Browse files
committed
fix py2 中文bug
1 parent e6d3a57 commit edab888

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

example/wxapp_api.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from datetime import datetime
44

55
from weixin import WXAPPAPI
6-
from weixin.helper import smart_str
6+
from weixin.helper import smart_bytes
77

88
appid = environ.get("WXAPP_APPID", "appid")
99
secret = environ.get("WXAPP_SECRET", "secret")
@@ -29,11 +29,11 @@
2929
},
3030
"keyword2": {
3131
# 备注
32-
"value": "请点击查看".encode("utf-8").decode("latin1")
32+
"value": smart_bytes("请点击查看").decode("latin1")
3333
},
3434
"keyword3": {
3535
# 状态
36-
"value": "图片已经生成".encode("utf-8").decode("latin1"),
36+
"value": smart_bytes("图片已经生成").decode("latin1"),
3737
"color": "#173177",
3838
},
3939
},
@@ -43,3 +43,4 @@
4343
api = WXAPPAPI(access_token=token)
4444
resp = api.send_template(json_body=json_body)
4545
print(resp)
46+

0 commit comments

Comments
 (0)