-
Notifications
You must be signed in to change notification settings - Fork 34
Expand file tree
/
Copy pathzippo.py
More file actions
90 lines (79 loc) · 2.96 KB
/
zippo.py
File metadata and controls
90 lines (79 loc) · 2.96 KB
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
"""
cron: 30 7 * * *
new Env("微信小程序-zippo")
env add zippo_auth
未完成
"""
#!/usr/bin/env python3
# coding: utf-8
import ApiRequest
from script_utils import (
build_weapp_headers,
log_event,
parse_response_content,
normalize_result,
parse_token_fields,
request_with_retry,
)
title = '微信小程序-zippo'
tokenName = 'zippo_auth'
class zippo(ApiRequest.ApiRequest):
def __init__(self, data):
super().__init__()
self.title = 'zippo签到'
(auth_token,) = parse_token_fields(data, expected_fields=1, field_names=('Authorization',))
self.sec.headers = build_weapp_headers(
host='wx-center.zippo.com.cn',
referer='https://servicewechat.com/wxaa75ffd8c2d75da7/69/page-frame.html',
user_agent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 MicroMessenger/7.0.20.1781(0x6700143B) NetType/WIFI MiniProgramEnv/Windows WindowsWechat/WMPF WindowsWechat(0x63090819) XWEB/8531',
extra_headers={
'Authorization': auth_token,
'x-app-id': 'zippo',
'x-platform-id': 'wxaa75ffd8c2d75da7',
'x-platform-env': 'release',
'x-platform': 'wxmp',
'Content-Type': 'application/json;charset=UTF-8',
},
)
def login(self):
try:
resp = request_with_retry(
self.sec,
'POST',
'https://wx-center.zippo.com.cn/api/daily-signin',
params='',
json={},
)
payload = parse_response_content(resp)
success, message = normalize_result(payload)
log_event('zippo_checkin_result', success=success, msg=message)
if success:
self.sendmsg += f'✅ zippo签到成功:{message}\n'
else:
self.sendmsg += f'❌ zippo签到失败:{message}\n'
except Exception as exc: # noqa: BLE001
log_event('zippo_checkin_failed', reason=str(exc))
self.sendmsg += f'❌ zippo签到失败:{exc}\n'
raise
def favorited(self):
jsonData = {
"targetType": "sku",
"targetId": "265",
"favorited": True
}
rj = self.sec.post('https://wx-center.zippo.com.cn/api/favorites', params='', json=jsonData).json()
print(rj)
rj = self.sec.post('https://wx-center.zippo.com.cn/api/missions/5/rewards', params='', json={"id":5}).json()
print(rj)
pass
def unfavorited(self):
jsonData = {
"targetType": "sku",
"targetId": "265",
"favorited": False
}
rj = self.sec.post('https://wx-center.zippo.com.cn/api/favorites', params='', json=jsonData).json()
print(rj)
pass
if __name__ == '__main__':
ApiRequest.ApiMain(['login', 'unfavorited', 'favorited']).run(tokenName, zippo)