-
Notifications
You must be signed in to change notification settings - Fork 197
/
Copy pathmain.py
58 lines (53 loc) · 2.13 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import requests, json, re, os
session = requests.session()
# 机场的地址
url = os.environ.get('URL')
# 配置用户名(一般是邮箱)
config = os.environ.get('CONFIG')
# server酱
SCKEY = os.environ.get('SCKEY')
login_url = '{}/auth/login'.format(url)
check_url = '{}/user/checkin'.format(url)
def sign(order,user,pwd):
global url,SEKEY
header = {
'origin': url,
'user-agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
}
data = {
'email': user,
'passwd': pwd
}
try:
print(f'===账号{order}进行登录...===')
print(f'账号:{user}')
response = json.loads(session.post(url=login_url,headers=header,data=data).text)
print(response['msg'])
# 进行签到
result = json.loads(session.post(url=check_url,headers=header).text)
print(result['msg'])
content = result['msg']
# 进行推送
if SCKEY != '':
push_url = 'https://sctapi.ftqq.com/{}.send?title=机场签到&desp={}'.format(SCKEY, content)
requests.post(url=push_url)
print('推送成功')
except:
content = '签到失败'
print(content)
if SCKEY != '':
push_url = 'https://sctapi.ftqq.com/{}.send?title=机场签到&desp={}'.format(SCKEY, content)
requests.post(url=push_url)
print('推送成功')
print('===账号{order}签到结束===\n'.format(order=order))
if __name__ == '__main__':
configs = config.splitlines()
if len(configs) %2 != 0 or len(configs) == 0:
print('配置文件格式错误')
exit()
user_quantity = len(configs)
user_quantity = user_quantity // 2
for i in range(user_quantity):
user = configs[i*2]
pwd = configs[i*2+1]
sign(i,user,pwd)