收藏
回答

python3 解密运动步数报错

小程序客户端调用 wx.getWeRunData  返回加密数据,回传给后台解密的时候报错,如下:


>>> WXBizDataCrypt(app_id, session_key).decrypt(encrypted_data, iv)

Traceback (most recent call last):

  File "<console>", line 1, in <module>

  File "/Users/stranger/workspace/ch_python/ch_common/weixin/interface.py", line 625, in decrypt

    decrypted = json.loads(self._unpad(cipher.decrypt(encryptedData)))

  File "/usr/local/Cellar/python3/3.6.3/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/__init__.py", line 349, in loads

    s = s.decode(detect_encoding(s), 'surrogatepass')

UnicodeDecodeError: 'utf-8' codec can't decode bytes in position 0-1: invalid continuation byte



相关数据:

app_id = 'wx808763acbb99479b'

session_key = 'VIR7ke64cW5V10si9wGEHA=='

encrypted_data = 'QbR34om5uf83A1c2bItWCRuaYesEExCjPZL7yTBd9WbzrVZOnnMRj6joLrh0nYFaoXfv4XEm6/pMlkF9LxxClbyzumFKXRJo/bMlzH3rcqsuzUfpz+FtGFjLixBVUW+9yr6B9V1h7mAlmpHjIN8DAN5nnekscnQDvnIxgOtcSayYjOH+i1vH8e5l9bYdKeSFJIFffnaFPBF3a3RHXOdGLzckPVyUD0XxY5HxSyGmi1kTty7whia8WaC4+UR2Hh/3RJbpk37dpAJ0YtdU1bkDBJV3/eRJGRuBHDoKF2Qad+rKiNBojLI1WMUZsVTb1loIEKjn2OjZSqvKCr2vvVZ4jXyQ+RKMdjVKBfA4kNyjUiEbI01jHwVvKUSll/szt1CxWpIYNPCT9bgqFMetUqklHhKkZgckp9NgmNqWZ5sNtcEknKpcG8lfvQOsSPZHf6P3ej1Zd1jDtn1v9UUcIJHhGULj0frvHfyTuwsL54nGGx8bdj7vW4SUwEE3mAyP0szPQgXshIAfa/AJt6wWaGzzq8xdtXyRm6VVZaK05PYcglx4EGXU3/acXllPZMxyqs4+nDB374oLZ7qBYj27TCA0s67AQTOBjUrnP4Yl0D8GqHGusIYLUtuCYB7VscdXVASY4gFs1E758B8y864UDI0dfpVpm7ZkRfT4Xvs5W+EWBI8lPSW/NqoIx2V4gZtdyBwkxuZwM5voZFxS+3H0Oj3xQRUvcA6C7EaZxGVgFn15xBq8s2T58MyAT7hTF4C4DrqQO8AaPPRxWjj8P9+J0AXngoEgPv5Kng35rzDDn7Z8Miz7F4m2pmlPu9+r0+ylW3TiiGmbYwu2KW8ou3iSY6SNV9lX6eFg+ia16//d/fw/rH/pgEttrUTov3vb6nqAA5KOSl/TdzUYy9NOZBMX1OUe7iJklGwtb6OVGhazwCEDBei1rGTJ8DmwuYO/20OcRrPWJPRGCubtJDTPMhFBRsRxNw2I6rf4jFEWhZLOQtpv7oykPCYo3lLHNa/mGgDct6KcaX14k/k0zhf/kHXKRbx1Q02zPgDty+mTREqdz0jNzgDtznESgkIvCmRn6Og6rUi+TcYA8eGMfHTIFsonyqH9dcKir7zG82Lk4KvV4k2jWMdqzvFEBFmOnoqK/AWdNH1dSKd2uNxfCzaP8l1Zml9ZxGx8jJ0ZTwC4cc1ubj8iLwquvzNNX8uqKxMDQnsoyUTavVdQeEZ3Qk2S4zKKiHalsbLr/mXavwNqJV8chxe04Y2DOUkW4X8YIImgkVJOVt/3ydt5gPl0fNrrNB8H6Bc4bkBcywVRZoZAEUmoKwTWzPty25OQcyp3U2VTN44OBwO2xaHS1xUMEinNh/kbd17bx5MpFEC6xr9EHt9JlaAGjDsdtAtKpckJTt6Q5SOFMTsk+H5pq4RTIGckiEzzEOkzjago6dDASCTVvfa03DWZlXMm8c6OgalhI08vQ3wCAuD5rBcYblzOeGJAX3Mo8zU7mPmgza8wJqviqfsFvST7LEQGGKMpvyfFEs3htSTR32kAAyAvQ91FL6+CbIovYSq3PHOyv9Th0ppmNkQKwflwI6hkL2NUbMq+I21oWOwKM+f2RUPnuSBmYg2n5spCDfr29w=='

iv = 'DlSrfDlXCJBcHwSKxINmbA=='



帮忙看看啥原因吧,偶现的,99%用户都没问题,但是一天总有几次报错

回答关注问题邀请回答
收藏

1 个回答

  • 子非🐟
    子非🐟
    2018-10-08

    有结果了么

    2018-10-08
    有用
    回复
登录 后发表内容