-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
write_msg.py
36 lines (26 loc) · 859 Bytes
/
write_msg.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import moe.config as cfg
# from moe.writer.echoer import Echoer
from moe.mailer.gmailer import Gmailer
from moe.encoder import Encoder
def main():
'''
1. email and echo encoded msg
2. delete MOE emails
3. email and echo picture
'''
morser = Encoder('examples/MORSE.csv')
# echoer = Echoer()
mailer = Gmailer(user=cfg.MAILER_USER,
destination=cfg.MAILER_DESTINATION)
phrase = 'NEPE'
encoded_phrase = morser.encode(phrase)
decoded_phrase = morser.decode(encoded_phrase)
msg = f'message: {phrase}\nencoded: {encoded_phrase}\ndecoded: {decoded_phrase}'
mailer.write(msg)
# echoer.write(msg)
# mailer.delete_all()
img_data = open('examples/picture.jpg', 'rb').read()
mailer.write_img(img_data)
# echoer.write_img(img_data)
if __name__ == '__main__':
main()