feat: multiple accounts

main
ZGGSONG 2 years ago
parent dc6c0eae04
commit 90f266b5dc

@ -38,8 +38,9 @@ def CheckIn(cookie):
mess = checkin.json()['message']
time = state.json()['data']['leftDays']
email = state.json()['data']['email']
days = time.split('.')[0]
msg = f'现在时间是:{time_now}\ncheckin: {checkin.status_code} | state: {state.status_code}\n{mess}\n剩余天数:{days}'
msg = f'现在时间是:{time_now}\nemail: {email}\ncheckin: {checkin.status_code} | state: {state.status_code}\n{mess}\n剩余天数:{days}'
checkin.close()
state.close()

@ -2,12 +2,17 @@
import yaml
# https://blog.csdn.net/weixin_41010198/article/details/111591030
def config():
# 获取yaml文件路径
yaml_path = 'config.yml'
# 使用open()函数读取config.yaml文件
yaml_file = open(yaml_path, "r", encoding="utf-8")
# 读取文件中的内容
file_data = yaml_file.read()
# print(f"file_date type: {type(file_data)}\nfile_date value:\n{file_data}")
yaml_file.close()
with open(yaml_path, 'rb') as f:
# yaml文件通过---分节,多个节组合成一个列表
date = yaml.safe_load_all(f)
# print(list(date))
return list(date)
# 加载数据流,返回字典类型数据
y = yaml.load(file_data, Loader=yaml.FullLoader)
return y

@ -1,2 +1,5 @@
cookies: #&&分割
bark_url:
cookies:
- #多cookie
bark_url: # bark app中的URL
send_key: # 将Server酱中的SendKey复制到此
token: # 将push plus微信公众号中的token复制到此

@ -1,4 +1,3 @@
from os import environ
from check import CheckIn
from push import send_msg_serverJ, send_msg_pushplus, send_bark
from config import config
@ -6,13 +5,14 @@ from config import config
def main():
conf = config()
# 获取actions secrets配置的cookie SendKey
ck = conf[0]['cookies']
# send_key = environ.get('SendKey')
# token = environ.get('token')
bark_url = conf[0]['bark_url']
ck = conf['cookies']
send_key = conf['send_key']
token = conf['token']
bark_url = conf['bark_url']
for c in ck:
try:
title, text = CheckIn(ck)
title, text = CheckIn(c)
print('签到成功!')
except Exception as e:
print('程序出错!')
@ -23,13 +23,13 @@ def main():
print(text)
# Text = Text.replace('\n', '%0D%0A%0D%0A')
# if send_key != '':
# rsp = send_msg_serverJ(send_key, title, text) # 推送消息无SendKey不推送
# print(rsp)
#
# if token != '':
# rsp = send_msg_pushplus(token, title, text) # 推送消息无token不推送
# print(rsp)
if send_key != '':
rsp = send_msg_serverJ(send_key, title, text) # 推送消息无SendKey不推送
print(rsp)
if token != '':
rsp = send_msg_pushplus(token, title, text) # 推送消息无token不推送
print(rsp)
if bark_url != '':
rsp = send_bark(bark_url, title, text)

Loading…
Cancel
Save