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

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 1: invalid start byte #401

Open
M2shad0w opened this issue Dec 13, 2018 · 3 comments
Labels
question 企业微信 企业微信接口相关

Comments

@M2shad0w
Copy link

from wechatpy.enterprise.crypto import WeChatCrypto
from wechatpy.exceptions import InvalidSignatureException
log.info("%s, %s, %s, %s" % (msg_signature, timestamp, nonce, echostr))
crypto = WeChatCrypto(sToken, sEncodingAESKey, sCorpID)

echo_str = crypto.check_signature(
    msg_signature,
    timestamp,
    nonce,
    echostr
)

File "/miniconda2/envs/py3/lib/python3.6/site-packages/wechatpy/utils.py", line 87, in to_text
return value.decode(encoding)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb6 in position 1: invalid start byte
-->

问题描述 (Description)

企业微信接口认证

配置信息 (Environment/Version)

  • OS
  • Python
    3.6

  • wechatpy
    1.75

@M2shad0w
Copy link
Author

M2shad0w commented Dec 14, 2018

run then demo, meet the same error
https://github.com/jxtech/wechatpy/blob/90b509a1bc7271234e860ac0c5fdb816877d98b7/examples/echo-enterprise/app.py#L33

/base.py", line 46, in _decrypt
    xml_length = socket.ntohl(struct.unpack(b'I', content[:4])[0])
struct.error: unpack requires a buffer of 4 bytes

@messense
Copy link
Member

Can you paste the related variable values?

@M2shad0w
Copy link
Author

M2shad0w commented Dec 17, 2018

wework get url

[ERROR] 2018-12-13 23:59:08,824 Uncaught exception GET /v1/wework?msg_signature=26222fa66ca085c5ad701a23d3d37d8344c4607d&timestamp=1544716748&nonce=1545138129&echostr=OqUjj41N1Gq3Rf5xitOLynuQ1q%2FuQDuuuqw3oVR8L3pVcEZ0hnjfxAqQKr5XqdOz%2Bd6OKdaS2peZF9PgtjvY9w%3D%3D (127.0.0.1)

@messense messense added question 企业微信 企业微信接口相关 labels Feb 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question 企业微信 企业微信接口相关
Projects
None yet
Development

No branches or pull requests

2 participants