forked from bighammer-link/jichang_checkin
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
43 lines (39 loc) · 1.31 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
import requests, json, re, os
session = requests.session()
# 机场的地址
url = os.environ.get('URL')
# 配置用户名(一般是邮箱)
email = os.environ.get('EMAIL')
# 配置用户名对应的密码 和上面的email对应上
passwd = os.environ.get('PASSWD')
# server酱
SCKEY = os.environ.get('SCKEY')
login_url = '{}/auth/login'.format(url)
check_url = '{}/user/checkin'.format(url)
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': email,
'passwd': passwd
}
try:
print('进行登录...')
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, 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)