try:
                    data_index[m]=quandl.get(mkts[m],authtoken=token).value
                except:
                    data_index[m]=quandl.get(mkts[m],authtoken=token).Rate
data_pct=data_index.pct_change()  



s=calc_ts_pairwise_correlation(data_pct)
s.dropna().to_csv('pairwise_c.csv')

s['2000':].plot(colormap='jet').get_figure().savefig('pairwise.png')

e=Email(subject='Morning Update: Pairwise Correlation')
e.add_attachment('pairwise.png')
e.send()


data_pct['2019':].cumsum().ffill().plot(colormap='brg').get_figure().savefig('YTD.png')

e=Email(subject='Morning Update: Macro YTD Email')
e.add_attachment('YTD.png')
e.send()




def get_sector_data():
      sp=SectorPerformances (key=key, output_format='pandas')
      data,_ = sp.get_sector()
      df = pd.DataFrame()
 def sendEmail(self, updatedPostViews):
     email = Email()
     email.send(updatedPostViews)
示例#3
0
#!/usr/bin/python
#coding:utf-8
import os
import sys
from datetime import *
from urlparse import urlparse
from jinja2 import Environment, FileSystemLoader
from mail import Email

if __name__ == "__main__":
    # get data
    log_result = 

    # generate using jinja2 template
    env = Environment(loader = FileSystemLoader('%s/templates' % os.path.dirname(os.path.abspath(__file__))))
    template = env.get_template('html.email.tpl')
    html_content = template.render(result = log_result)

    # mail 
    email = Email(smtp = 'smtp.company.com') 
    email.send(sender = '*****@*****.**',
              receiptors = ["*****@*****.**", "*****@*****.**", "*****@*****.**"],
              cc = '*****@*****.**',
              subject = 'email subject',
              content = html_content,
              content_subtype = 'html',
              attachment = ['/file/path/to/attachment'])
示例#4
0
文件: pymail.py 项目: rexos/pymail
sys.path.insert( 0, PATH + '/module' )

from getpass import getpass, getuser
from checker import Checker
from mail import Email

name = os.environ.get('PYMAIL_ADR')
if not name:
    name = raw_input('User : '******'Sorry .. retry')
        psw = getpass()
    e = Email( name, psw )
    try:
        e.send()
    except:
        print('\nSomething went wrong, retry')
    else:
        if e.failed:
            print('Failed sending to ' + str(e.failed))
        else:
            print('Sent')
except KeyboardInterrupt:
    print('\nTerminated')
    sys.exit(0)
示例#5
0
from mail import Email

if __name__ == '__main__':
    mail = Email(to='*****@*****.**', subject='Adaptation Complete')
    ctx = {'username': '******'}
    mail.text('adaptation.txt', ctx)
    mail.html('adaptation.html', ctx)  # Optional
    mail.send()

示例#6
0
    tfs = TfsUtils(url, auth)
    items = tfs.find_stored_query()
    name = set()

    for item_id in items:
        work_item = tfs.find_work_item(item_id)
        if work_item["24"] not in name:
            rest_time = work_item["10000"] - 8
            used_time = work_item["10052"] + 8

            data = {
                u"10000": rest_time,
                u"10052": used_time
            }

            tfs.update_work_item(item_id, data)
            name.add(work_item["24"])

        print item_id

except Exception, e:
    # print exception info
    print Exception, ":", e
    subject = "TFS报工失败"
    text = "失败原因" + str(e)
    traceback.print_exc()
    # Email notification
    email = Email(config)
    email.send(subject, text)