mirror of
https://github.com/Death916/emailtrade.git
synced 2026-04-10 03:04:40 -07:00
working on getting right message
This commit is contained in:
parent
71c619abf4
commit
7baffcda54
1 changed files with 24 additions and 3 deletions
27
getsignal.py
27
getsignal.py
|
|
@ -6,8 +6,29 @@ import pyzmail
|
|||
imap = imapclient.IMAPClient('imap.gmail.com', ssl=True)
|
||||
imap.login('tavn1992@gmail.com', 'tzzjgbzdtadlflls')
|
||||
imap.select_folder('CRYPTO/trade', readonly=True)
|
||||
msg = imap.fetch([3], [b'BODY[]', b'FLAGS'])
|
||||
|
||||
message = pyzmail.PyzMessage.factory(msg[3][b'BODY[]'])
|
||||
|
||||
print(message.get_subject())
|
||||
alert = imap.search(b'SEEN')
|
||||
|
||||
for num in range(0, 100000):
|
||||
if num in alert:
|
||||
uid = num
|
||||
|
||||
|
||||
msg = imap.fetch([uid], [b'BODY[]', b'FLAGS'])
|
||||
|
||||
|
||||
message = pyzmail.PyzMessage.factory(msg[uid][b'BODY[]'])
|
||||
|
||||
if 'strategy says sell now' in message.get_subject():
|
||||
print('sell signal found')
|
||||
print(message.get_subject())
|
||||
elif 'strategy says buy now' in message.get_subject():
|
||||
print('buy signal found')
|
||||
print(message.get_subject())
|
||||
|
||||
|
||||
else:
|
||||
|
||||
print('failed')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue