Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wechat-sdk3版本中微信加密消息接口的小问题 #64

Closed
donaldzz opened this issue Feb 26, 2016 · 1 comment
Closed

wechat-sdk3版本中微信加密消息接口的小问题 #64

donaldzz opened this issue Feb 26, 2016 · 1 comment
Assignees
Labels

Comments

@donaldzz
Copy link

非常感谢你的项目,可以节省许多处理与微信接口连接的工作。
在开发中发现,python3版本的代码在处理加密的消息接口时,返回消息被微信服务器解析失败。经过与官方sample比对,发现问题可能出在加密前的字符串拼接上,python2与python3的len函数返回值不同造成的。
我暂时将 encrypt方法中struct.pack('I', socket.htonl(len(text))) 变更为 struct.pack('I', socket.htonl(len(text.encode())))后程序可以正常执行了。
期待你有更好的解决方案。

@doraemonext doraemonext self-assigned this Feb 26, 2016
@doraemonext
Copy link
Owner

已经修复,具体代码中修改了不少地方以适配 Python 3,主要是 str/bytes 和 unicode/str 的问题。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants