minor fix
This commit is contained in:
20
main.py
20
main.py
@@ -48,10 +48,6 @@ inbox, outbox = Queue(), Queue()
|
|||||||
connection = None
|
connection = None
|
||||||
socket = None
|
socket = None
|
||||||
|
|
||||||
sent = 0
|
|
||||||
errors = 0
|
|
||||||
warnings = 0
|
|
||||||
|
|
||||||
class Greetings:
|
class Greetings:
|
||||||
def __init__(self, locale: str, timezone: str, default: str, morning=None, afternoon=None, evening=None, predicate=None):
|
def __init__(self, locale: str, timezone: str, default: str, morning=None, afternoon=None, evening=None, predicate=None):
|
||||||
self.locale = locale
|
self.locale = locale
|
||||||
@@ -325,12 +321,11 @@ def main(driver: WebDriver):
|
|||||||
index = 0
|
index = 0
|
||||||
status = Status.ACTIVE
|
status = Status.ACTIVE
|
||||||
occurrences = {}
|
occurrences = {}
|
||||||
|
sent = 0
|
||||||
|
errors = 0
|
||||||
|
warnings = 0
|
||||||
|
|
||||||
while status.isactive() and index < limit:
|
while status.isactive() and index < limit:
|
||||||
global warnings
|
|
||||||
global errors
|
|
||||||
global sent
|
|
||||||
|
|
||||||
attempt = 0
|
attempt = 0
|
||||||
current = index
|
current = index
|
||||||
index += 1
|
index += 1
|
||||||
@@ -358,7 +353,7 @@ def main(driver: WebDriver):
|
|||||||
clean = True
|
clean = True
|
||||||
attempt += 1
|
attempt += 1
|
||||||
request = get_request()
|
request = get_request()
|
||||||
print('[信息] 正在发送:%s (%.2f %%)' % (recipient, current / limit * 100))
|
tell('[信息] 正在发送:%s (%.2f %%)' % (recipient, current / limit * 100))
|
||||||
|
|
||||||
if (target := get_address()) != address:
|
if (target := get_address()) != address:
|
||||||
exception = Exception(f'邮件发件地址与设定不一致\n>> {address}\n>> {target}')
|
exception = Exception(f'邮件发件地址与设定不一致\n>> {address}\n>> {target}')
|
||||||
@@ -490,7 +485,8 @@ def main(driver: WebDriver):
|
|||||||
status = Status.INACTIVE
|
status = Status.INACTIVE
|
||||||
|
|
||||||
progress = index / limit * 100
|
progress = index / limit * 100
|
||||||
print('[信息] 当前进度:%.2f %%' % progress)
|
tell('[信息] 当前进度:%.2f %%' % progress)
|
||||||
|
tell(f'已发送 {sent} 封;发送失败 {errors} 封;跳过重复项 {warnings} 个')
|
||||||
|
|
||||||
if parameters.get('save'):
|
if parameters.get('save'):
|
||||||
try:
|
try:
|
||||||
@@ -565,6 +561,4 @@ if __name__ == '__main__':
|
|||||||
status = 1
|
status = 1
|
||||||
finally:
|
finally:
|
||||||
driver.quit()
|
driver.quit()
|
||||||
|
exit(status)
|
||||||
tell(f'已发送 {sent} 封;发送失败 {errors} 封;跳过重复项 {warnings} 个')
|
|
||||||
exit(status)
|
|
||||||
|
|||||||
Reference in New Issue
Block a user