-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathapp.py
44 lines (32 loc) · 1022 Bytes
/
app.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
37
38
39
40
41
42
43
44
import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), './cls-s'))
from gmail import Gmail
from venture_info import Info
from temp_builder import Builder
# import Gmail from cls-s/gmail.py
# import Info from cls-s/venture_info
# import Builder from cls-s/temp_builder
mail = Gmail()
info = Info()
temp = Builder()
stockURL = 'https://api.iextrading.com/1.0/stock/'
symbols = ['AMZN', 'GOOGL', 'AAPL'] # add more stock symbols
summary = []
articles = []
ventureName = []
exchange = []
try:
# Fetching latest articles
for i in symbols:
summary.append(info.get_summary(i, stockURL))
articles.append(info.get_articles(i, stockURL))
ventureName.append((info.get_venture_name(i, stockURL)))
exchange.append(info.get_exchange(i, stockURL))
# Jinja2 temp building
body = temp.build_temp(symbols, summary, articles, ventureName, exchange)
# Send Email
mail.send_email(body)
print('Email sent!')
except Exception as e:
print(str(e))