|
@@ -45,12 +45,15 @@ def mail_alert():
|
|
msgs = [msgs for msgs in mailbox.fetch(AND(seen=False), mark_seen=True)]
|
|
msgs = [msgs for msgs in mailbox.fetch(AND(seen=False), mark_seen=True)]
|
|
for msg in msgs:
|
|
for msg in msgs:
|
|
chk = mask(msg, 'account')
|
|
chk = mask(msg, 'account')
|
|
|
|
+ # print(chk)
|
|
if chk:
|
|
if chk:
|
|
if msg.uid not in container:
|
|
if msg.uid not in container:
|
|
|
|
+ # print(f'{msg.uid} not in container')
|
|
soup = BeautifulSoup(msg.html, 'html.parser')
|
|
soup = BeautifulSoup(msg.html, 'html.parser')
|
|
msg_text = soup.prettify().replace('<br/>', '').replace('<html>', '').replace('<head>', '').replace('</head>', '').replace('<body>', '').replace('<div>', '').replace('</div>', '').replace('</body>', '').replace('</html>', '')
|
|
msg_text = soup.prettify().replace('<br/>', '').replace('<html>', '').replace('<head>', '').replace('</head>', '').replace('<body>', '').replace('<div>', '').replace('</div>', '').replace('</body>', '').replace('</html>', '')
|
|
|
|
+ msg_text = msg_text[:msg_text.find('Intraday transactions')]
|
|
try:
|
|
try:
|
|
- if len(msg.text) != 0:
|
|
|
|
|
|
+ if len(msg.text) or len(msg.html) != 0:
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text)
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text)
|
|
else:
|
|
else:
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text)
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text)
|
|
@@ -58,7 +61,7 @@ def mail_alert():
|
|
print('message appended', len(container))
|
|
print('message appended', len(container))
|
|
except BadRequest:
|
|
except BadRequest:
|
|
try:
|
|
try:
|
|
- if len(msg.text) != 0:
|
|
|
|
|
|
+ if len(msg.text) or len(msg.html) != 0:
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text // 5)
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text // 5)
|
|
else:
|
|
else:
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text // 5)
|
|
bot.send_message(chat_id=config['AUTH']['chatid'], text=msg_text // 5)
|