<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Java 企業應用
    不要溫柔的走入那個良夜

    將下面的源碼存為 send_notifications.py ,然后 用python send_notifications.py XX XX 使用。

    import
     smtplib
    import time
    import sys
    import os, shutil

    print "Usage:python", sys.argv[0], "[recipient](1..n) reports_dir"
    print "Example:python", sys.argv[0], " wilson@ex.com jake@ex.com /opt/reports"

    # constants
    fromaddr = "*****@gmail.com"
    password 
    = ''

    def timestamp():
        ISOTIMEFORMAT 
    = "%Y-%m-%d-%X"
        
    return str(time.strftime(ISOTIMEFORMAT))

    def send_mail(fromaddr, password, toaddrs, reports_dir):
        server 
    = smtplib.SMTP('smtp.gmail.com:587')
        server.ehlo()
        server.starttls()
        server.login(fromaddr, password)
        
    for x in toaddrs:server.sendmail(fromaddr, x, mail_content(x, reports_dir))
        server.quit()
        
    def read_surefire_report(reports_dir):
        report_lines 
    = []
        
    if os.path.isdir(reports_dir):
            reports 
    = os.listdir(reports_dir)
            
    for x in reports:
                
    if x.endswith(".txt"):
                    with open(
    "%s/%s" % (reports_dir, x), "r") as f:
                        report_lines.extend(f.readlines())
        
    return report_lines

    def mail_content(recipient, reports_dir):
        recipient_name 
    = recipient.split("@")[0]
        site_endpoint 
    = "http://***********:8080/sce-deck"
        mail_body 
    = [
          
    "From: Decker<%s>" % fromaddr,
          
    "To: %s<%s>" % (recipient_name, recipient),
          
    "Subject: SCE-DECK-REPORT-" + timestamp(),
          
    "",
          
    "hi,%s" % recipient_name,
          
    "",
          
    "Junit Testcase %s/surefire-report.html" % site_endpoint,
          
    "Test Coverage  %s/cobertura/index.html" % site_endpoint,
          
    "Tag List %s/taglist.html" % site_endpoint,
          
    "Duplicate code detection %s/cpd.html" % site_endpoint ,
          
    "Verification of coding rules %s/pmd.html" % site_endpoint,
          
    "",
          
    "Test Result Quick View:"
          ]
        mail_body.extend(read_surefire_report(reports_dir))
        mail_body.extend(
          [ 
    "What's more ?",
          
    "Project,Dependencies,javadoc ,test javadoc ,Test Source Xref, Source Xref ",
          site_endpoint,
          
    ""
          ])
        
    return "\r\n".join(mail_body)

    if __name__ == "__main__":
        recipients 
    = sys.argv[1:-1:] if len(sys.argv[:]) > 2 else [] 
        reports_dir 
    = sys.argv[-1]
        
    if len(recipients) > 0:
            
    print ">> Send mail to "",".join(recipients)
            
    print ">> Reports - ", reports_dir
            send_mail(fromaddr, password, recipients, reports_dir)
        
    else:
            
    print ">> No boby is in the recipients."                                                                                                                                                                                                                                                                                                       



    posted on 2013-07-29 09:22 cpegtop 閱讀(175) 評論(0)  編輯  收藏 所屬分類: Python

    只有注冊用戶登錄后才能發表評論。


    網站導航:
     
     
    主站蜘蛛池模板: 最近2022中文字幕免费视频| 色婷婷六月亚洲综合香蕉| 在线看片免费人成视频久网下载| 免费国产小视频在线观看| 亚洲精品国产高清在线观看| 成年在线观看免费人视频草莓| 亚洲中文字幕一区精品自拍| 青青青国产在线观看免费| 亚洲一区二区三区亚瑟| 毛片在线看免费版| 中文日韩亚洲欧美制服| 日本特黄特色aa大片免费| 免费VA在线观看无码| 国产成人亚洲精品狼色在线| 中文精品人人永久免费| 亚洲午夜久久影院| 免费在线观看h片| 亚洲精品av无码喷奶水糖心| 亚洲国产精品丝袜在线观看| 久久WWW免费人成—看片| 亚洲av永久无码精品秋霞电影影院| 久久国产精品萌白酱免费| 亚洲a级成人片在线观看| 日韩免费视频一区| 久久精品成人免费国产片小草| 亚洲精品乱码久久久久久按摩 | 亚洲午夜成激人情在线影院| 成人免费无码大片a毛片软件| 免费人成网站永久| 亚洲AV成人一区二区三区AV| 国产在线观看片a免费观看| 国产成人亚洲毛片| 亚洲av无码乱码国产精品| 亚洲免费网站观看视频| sihu国产精品永久免费| 亚洲国产日韩在线成人蜜芽| 无码欧精品亚洲日韩一区夜夜嗨 | 野花高清在线电影观看免费视频| 亚洲AV无码AV吞精久久| 亚洲精品国产精品乱码视色| 国产一卡2卡3卡4卡2021免费观看|