mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
chore: error handling in mailing script [skip ci]
This commit is contained in:
parent
c42985a279
commit
749782b15b
@ -1,4 +1,5 @@
|
|||||||
import argparse
|
import argparse
|
||||||
|
import logging
|
||||||
import time
|
import time
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
@ -36,8 +37,11 @@ def send(recipient: str, subject: str, content: str, is_html: bool = False, base
|
|||||||
def run(args):
|
def run(args):
|
||||||
content, is_html = read_mail_content(args.content)
|
content, is_html = read_mail_content(args.content)
|
||||||
for recipient in tqdm(read_recipients(args.recipients)):
|
for recipient in tqdm(read_recipients(args.recipients)):
|
||||||
send(recipient, args.subject, content, is_html, args.mw_url)
|
try:
|
||||||
time.sleep(args.throttle)
|
send(recipient, args.subject, content, is_html, args.mw_url)
|
||||||
|
time.sleep(args.throttle)
|
||||||
|
except Exception as e:
|
||||||
|
logging.warning(f'failed to send to {recipient}, {e}')
|
||||||
|
|
||||||
|
|
||||||
def parse_arguments():
|
def parse_arguments():
|
||||||
|
Loading…
Reference in New Issue
Block a user