[Asm] 纯文本查看 复制代码import json
import requests
import datetime
url = "http://open.iciba.com/dsapi/"
head = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36'},
a = datetime.datetime.now()
today = datetime.date.today()
day_of_week = today.weekday()
c = ['星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'][day_of_week]
time = a.strftime(f"%Y年%m月%d日 {c} %H:%M:%S")
b = datetime.datetime(2024, 2, 9)
count_down = (b - a).days
resp = requests.get(url, headers=head)
r = json.loads(resp.text)
content = r["content"] + "\n" + r["note"]
print("今天是", time, "\n", content, f"距离除夕还有{count_down}天")
info = "今天是"+time+"\n"+content+f"距离除夕还有{count_down}天"
data = {"method": "sendText", "wxid": "填写微信号", "msg": info}
url = f'http://127.0.0.1:8203/api?json={json.dumps(data)}&key=44468FAE112ACFB7F45643CC5CBC55A5D8DCD006'
data = {"method": "sendText", "wxid": "填写微信号", "msg": info}
url1 = f'http://127.0.0.1:8203/api?json={json.dumps(data)}&key=44468FAE112ACFB7F45643CC5CBC55A5D8DCD006'
requests.get(url)
requests.get(url1)