规避push有时json报错的问题

修复心跳包帧头错误
This commit is contained in:
murmur 2023-03-23 09:28:23 +08:00
parent 9d9cf6f768
commit 6367751b7a

View File

@ -51,11 +51,15 @@ _{datetime.datetime.now()}_
{content}""", {content}""",
"token": "tt" "token": "tt"
}) })
res = res.json() try:
if res["success"]: res = res.json()
return None except:
return
else: else:
return res["message"] if res["success"]:
return None
else:
return res["message"]
cache = defaultdict(list) cache = defaultdict(list)
@ -173,6 +177,7 @@ def tt_hh(addr, data):
update_pairs(addr, ccid) update_pairs(addr, ccid)
# 组帧再返回 # 组帧再返回
msg = bytearray(data[:]) msg = bytearray(data[:])
msg[:5] = b"$TTMX"
val = "%04x" % int(time.time()) val = "%04x" % int(time.time())
tmp=[] tmp=[]
for i in range(0,len(val),2): for i in range(0,len(val),2):