@@ -15,7 +15,7 @@ def send_wechat(user_index, msg):
15
15
wechat_url += '?appToken=' + config .app_token
16
16
wechat_url += '&content=' + msg
17
17
wechat_url += '&uid=' + config .users [user_index ]['uid' ]
18
- response = requests .get (wechat_url )
18
+ requests .get (wechat_url )
19
19
20
20
21
21
def report (user_index ):
@@ -57,7 +57,8 @@ def report(user_index):
57
57
browser .find_element_by_class_name ('success' )
58
58
except exceptions .NoSuchElementException :
59
59
print ('[Error] Login failed' )
60
- send_wechat (user_index , strings .get_msg_failed (user_index ))
60
+ if config .users [user_index ]['use_wechat' ]:
61
+ send_wechat (user_index , strings .get_msg_failed (user_index ))
61
62
browser .quit ()
62
63
quit (1 )
63
64
@@ -106,7 +107,8 @@ def report(user_index):
106
107
browser .find_element_by_id ('fineui_27' )
107
108
except IndexError :
108
109
print ('[Error] Submit failed' )
109
- send_wechat (user_index , strings .get_msg_failed (user_index ))
110
+ if config .users [user_index ]['use_wechat' ]:
111
+ send_wechat (user_index , strings .get_msg_failed (user_index ))
110
112
browser .quit ()
111
113
quit (0 )
112
114
@@ -129,7 +131,8 @@ def report(user_index):
129
131
browser .find_element_by_id ('fineui_32' )
130
132
except exceptions .NoSuchElementException :
131
133
print ('[Error] Submit timeout' )
132
- send_wechat (user_index , strings .get_msg_failed (user_index ))
134
+ if config .users [user_index ]['use_wechat' ]:
135
+ send_wechat (user_index , strings .get_msg_failed (user_index ))
133
136
browser .quit ()
134
137
quit (0 )
135
138
@@ -150,7 +153,8 @@ def report(user_index):
150
153
151
154
if txt .find (strings .msg ['success_msg' ]) == - 1 :
152
155
print ('[Error] Check failed' )
153
- send_wechat (user_index , strings .get_msg_failed (user_index ))
156
+ if config .users [user_index ]['use_wechat' ]:
157
+ send_wechat (user_index , strings .get_msg_failed (user_index ))
154
158
browser .quit ()
155
159
quit (1 )
156
160
@@ -165,8 +169,9 @@ def report(user_index):
165
169
date = datas .group (1 ) + '-' + datas .group (2 ) + '-' + datas .group (3 )
166
170
167
171
print ('[Info] ' + 'Date: ' + date + ', Rank: ' + str (rank ))
168
- send_wechat (user_index , strings .get_msg_success (
169
- user_index , date , rank , temperature ))
172
+ if config .users [user_index ]['use_wechat' ]:
173
+ send_wechat (user_index , strings .get_msg_success (
174
+ user_index , date , rank , temperature ))
170
175
time .sleep (1 )
171
176
172
177
browser .quit ()
0 commit comments