[Fix]Close #1239
This commit is contained in:
parent
272857792e
commit
4229f6e210
@ -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
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user