From e1b9999c0d292bd5d19b1ee634ef11ee3c17ac59 Mon Sep 17 00:00:00 2001 From: SiHuan Date: Fri, 20 Mar 2020 22:51:35 +0800 Subject: [PATCH] inx ++ --- worker/inx.py | 5 +++-- zzcore.py | 12 ++++++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/worker/inx.py b/worker/inx.py index 8c3da5d..73c74b2 100644 --- a/worker/inx.py +++ b/worker/inx.py @@ -15,11 +15,12 @@ class Ans(StdAns): if cmd == 'start': self.DATASET({'status':'1'}) self.sendmsg('inx 启动!') - while(self.DATAGET()['status'] == 1): + while(self.DATAGET()['status'] == '1'): req = requests.get("https://hq.sinajs.cn/etag.php?_=1584712625172&list=gb_$inx") num = req.text[28:].split(",")[1] - self.sendmsg('标普500现在情况: ' + num) + msgid = self.sendmsg('标普500现在情况: ' + num) time.sleep(10) + self.delmsg(msgid) return "现在 inx 真的停了!" diff --git a/zzcore.py b/zzcore.py index 01f9103..1f37c15 100644 --- a/zzcore.py +++ b/zzcore.py @@ -50,3 +50,15 @@ class StdAns(): 'message': msg } return requests.post(url = url, data = json.dumps(data),headers = Headers).json()['data']['message_id'] + + + def delmsg(self,msgid): + url = APIURL + "delete_msg" + Headers = { + 'content-type': 'application/json', + 'Authorization':'Bearer ' + AUTHORIZATION + } + data = { + 'message_id' : msgid, + } + requests.post(url = url, data = json.dumps(data),headers = Headers) \ No newline at end of file