This commit is contained in:
vn.py 2018-11-17 09:53:14 +08:00
parent 272857792e
commit 4229f6e210

View File

@ -6,6 +6,7 @@ import ssl
import hashlib
import json
import traceback
import zlib
from threading import Thread
from time import sleep
@ -145,7 +146,13 @@ class OkexApi(object):
#----------------------------------------------------------------------
def readData(self, evt):
"""解码推送收到的数据"""
data = json.loads(evt)
# 先解压
decompress = zlib.decompressobj(-zlib.MAX_WBITS)
inflated = decompress.decompress(evt)
inflated += decompress.flush()
# 再转换为json
data = json.loads(inflated)
return data
#----------------------------------------------------------------------