代码拉取完成,页面将自动刷新
'''
Author: duliang [email protected]
Date: 2024-06-25 23:09:28
LastEditors: duliang [email protected]
LastEditTime: 2024-07-06 19:01:18
FilePath:
Description:
'''
import MYQQ_http
from flask import Flask, request, jsonify
from urllib.parse import unquote
import time
from datetime import datetime
from threading import Thread
import uuid
import requests
from getsw import getsw
def get_uuid():
return str(uuid.getnode())
HOUR = 19
MIN = 2
SEC = 0
QQNUM = 3858582700
QQGROUP = 980964246
APIport = 8848
token = 1101
callback_port = 5004
MYQQ_http.echo_mode = True
MYQQ_http.global_set(APIport, token, callback_port)
QQ = MYQQ_http.robot(QQNUM)
SWURL = 'https://16gs832674.oicp.vip/qq'
def check_time():
content = ''
while 1:
now = datetime.now()
print(now, end='\r')
if (now.hour == HOUR) and (now.minute == MIN) and (now.second == SEC):
content = getsw()
# 获取水情信息发送到群里 content = get_water_info()
MYQQ_http.send_msg(bot_name=QQ,
toQQ=QQGROUP,
content=content,
anony=False,
group=True)
time.sleep(1)
# MYQQ_http.send_msg(bot_name=QQ,
# toQQ=QQGROUP,
# content=str(int(time.time())),
# anony=False,
# group=True)
app = Flask(__name__)
@app.route('/qq', methods=['GET', 'POST'])
def index():
if request.method == 'POST':
print(request.json)
resp_json = request.json
try:
t = resp_json['MQ_type']
msg = unquote(resp_json['MQ_msg'], 'utf-8')
print(msg)
except Exception as e:
print(e)
return jsonify({'status': 'ok'})
else:
return jsonify({'status': 'ok'})
if __name__ == '__main__':
t = Thread(target=check_time)
t.daemon = True
t.start()
app.run(host='0.0.0.0', port=5005)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。