代码拉取完成,页面将自动刷新
import datetime
import json
import os
import pprint
import random
import time
import requests
import hashlib
def get_nonce():
"""
生成一个指定长度的随机字符串
"""
randomlength = 16
random_str = ''
base_str = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'
length = len(base_str) - 1
for i in range(randomlength):
random_str += base_str[random.randint(0, length)]
# print(random_str)
return random_str
def signIn(ck, msg=None):
url = 'https://zhiwen.xfyun.cn/api/user/signIn'
headers = {
'Cookie': ck,
'Content-Type': 'application/json'
}
response = requests.post(url=url, headers=headers).json()
msg += ('签到返回: ' + json.dumps(response))
return msg
def webhook(message, webhookToken):
url = f'http://www.pushplus.plus/send'
headers = {
'Content-Type': 'application/json'
}
data = {
"token": webhookToken,
"title": "讯飞智文",
"content": message,
"template": "json"
}
response = requests.post(url=url, data=json.dumps(data), headers=headers).json()
print(f"企业微信推送成功{response}")
def sleepmoment():
random_seconds = random.randint(1, 10)
time.sleep(random_seconds)
if __name__ == '__main__':
sleepmoment()
cks = os.environ['xfzw']
cks = cks.split('@')
webhookToken = os.environ['PUSH_PLUS_TOKEN']
msg = ""
for ck in cks:
msg += signIn(ck, msg)
print(f'消息: {msg}')
webhook(msg, webhookToken)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。