コード例 #1
0
 def __init__(self):
     self._configreader = ConfigReader()
     self._addressesprovider = AddressesProvider()
     self._messageprovider = MessageProvider(
         self._configreader.GetConfiguration("known_files"),
         self._configreader.GetConfiguration("signature"))
     self._messagelogger = MessageLogger()
     self._mailsender = SendMail(
         self._configreader.GetConfiguration("sender_email"))
     self._previewmail = MailPreview()
     self._previewmail.Preview(self._messageprovider.GetMessage()[1])
コード例 #2
0
    def execute(self):
        """ Run the handler. """
        title = "Comics {0}".format(time.strftime('%Y-%m-%d %H:%M:%S',
                                                  time.localtime()))
        self.creators('Andy Capp', 'andy-capp')
        self.creators('B.C.', 'bc')
        self.kingdom('Beetle Bailey', 'beetle-bailey')
        self.go_comics('Betty', 'betty')
        self.go_comics('Broom Hilda', 'broomhilda')
        self.go_comics('Calvin and Hobbes', 'calvinandhobbes')
        self.kingdom('Crock', 'crock')

        date = time.strftime('%Y-%m-%d', time.localtime())
        url = 'https://dilbert.com/strip/{}'.format(date)
        self.generic('img-responsive img-comic', 'src="', 'Dilbert', url)

        self.generic('div class="MainComic__ComicImage', 'img src="',
                     'Explosm', 'http://explosm.net')
        self.go_comics('Garfield', 'garfield')
        self.kingdom('Hagar the Horrible', 'hagar-the-horrible')
        self.go_comics('Pearls before Swine', 'pearlsbeforeswine')
        self.kingdom('Sam and Silo', 'sam-and-silo')
        self.kingdom('Zits', 'zits')

        page = self.page(title, self.html)
        SendMail().deliver(title, page)
コード例 #3
0
ファイル: trellotodo.py プロジェクト: bschau/Portfolio
    def execute(self):
        """ TrelloTodo runner. """
        board_id = self.get_board_id(self.board_name)
        lists = self.get_lists_for_board(board_id)
        cards = self.get_cards(board_id)

        html = self.create_html(cards, lists)
        title = self.title()
        body = self.page(title).format(html)
        SendMail('TrelloTodo').deliver(title, body)
コード例 #4
0
ファイル: app.py プロジェクト: sunguangquan/shblai
def send():
    if request.method == "GET":
        username = servers.get("mail")
        return render_template("send.html", username=username)
    if request.method == "POST":
        content = GetCsv(request.files.get("file"))
        sub = request.form.get("sub")
        html = request.form.get("editor1")
        server = zmail.server(servers.get("mail"), servers.get("passwd"),
                              servers.get("host"), servers.get("port"))
        SendMail(server, content, sub, html, att)
        return "发送成功!"
コード例 #5
0
ファイル: lichess.py プロジェクト: bschau/Portfolio
    def execute(self):
        """ Lichess runner. """
        token = self.get_token()
        jsondata = self.fetch_overview(token)

        if jsondata is not None:
            overview = json.loads(jsondata.decode('utf-8'))
            games = self.get_my_turn_games(overview)
            if games:
                html = self.games_to_html(games)
                title = self.title()
                page = self.page(title).format(html)
                SendMail('Lichess').deliver(title, page)
コード例 #6
0
ファイル: events.py プロジェクト: bschau/Portfolio
    def execute(self):
        """ Events backbone handler. """
        title = self.title()
        page = self.page(title)
        all_times = self.build_time_constants()
        events = self.get_events(all_times)
        if events:
            events.sort(key=lambda tup: tup[0])

            html = ""
            for event in events:
                html += '<p style="font-size: 20px">'
                html += event.glyph + " " + event.text + "</p>"

            SendMail('Events').deliver(title, page.format(html))
コード例 #7
0
    def build(self):
        manager = ScreenManager()
        print("building")
        Window.size = (500, 500)
        manager.add_widget(Login(name='login'))
        manager.add_widget(Connected(name='connected'))
        manager.add_widget(Options(name='options'))
        manager.add_widget(Screen1(name='screen1'))
        manager.add_widget(Screen2(name='screen2'))
        manager.add_widget(Screen3(name='screen3'))
        manager.add_widget(SendMail(name='sendmail'))
        manager.add_widget(Search(name='search'))
        manager.add_widget(Latest(name='latest'))
        #manager.add_widget(Done(name='done'))

        return manager
コード例 #8
0
class MailSloth:
    def __init__(self):
        self._configreader = ConfigReader()
        self._addressesprovider = AddressesProvider()
        self._messageprovider = MessageProvider(
            self._configreader.GetConfiguration("known_files"),
            self._configreader.GetConfiguration("signature"))
        self._messagelogger = MessageLogger()
        self._mailsender = SendMail(
            self._configreader.GetConfiguration("sender_email"))
        self._previewmail = MailPreview()
        self._previewmail.Preview(self._messageprovider.GetMessage()[1])

    def Send(self, password):
        msg = self._messageprovider.GetMessage()
        self._mailsender.SendMails(self._addressesprovider.GetEmails(), msg,
                                   password)
        self._messagelogger.LogMessage(msg)
コード例 #9
0
ファイル: bookcal.py プロジェクト: godestalbin/bookcal
def registerNewBooking(booking):
        mongo.add({
            'roomName': booking.roomId,
            'startDate': datetime.strptime(booking.startDate, '%Y-%m-%d'),
            'endDate': datetime.strptime(booking.endDate, '%Y-%m-%d'),
            'customerName': booking.name,
            'customerMail': booking.mail,
            'customerPhone': booking.phone
        })
        if flaskapp.config['OS_NAME'] != 'nt':  # Send SMS message only on Linux
        # Send confirmation SMS to us
            msg = 'Réservation pour La Lande du ' + booking.startDate + ' au ' + booking.endDate + '\r\n' + \
            'Nom: ' + booking.name + '\r\n' \
            'Phone: ' + booking.phone + '\r\n' \
            'Mail: ' + booking.mail + '\r\n'
            sendSms = SendSms()
            sendSms.sendMessage(msg)
        sendMail = SendMail(booking)
コード例 #10
0
ファイル: newsfeed.py プロジェクト: bschau/Portfolio
    def execute(self):
        """ Run the handler. """
        cache = self.get_cache_file()
        self.html = ""

        line_number = 0
        feeds = self.get_feeds()

        seen = {}
        for feed in feeds:
            line_number = self.load_feed(cache, seen, line_number, feed)

        if line_number > 0:
            title = self.title()
            page = self.page(title, self.html)
            SendMail('Newsfeed').deliver(title, page)

        self.persist_seen(cache, seen)
        self.expire(cache)
コード例 #11
0
    def execute(self):
        """ Run the handler. """
        cut_off = datetime.datetime.now() - datetime.timedelta(hours=25)
        feedparser.USER_AGENT = 'kwed-lambda/3.0'
        rss = feedparser.parse('https://remix.kwed.org/rss.xml')
        if rss.bozo > 0:
            return

        prefix = 'New C64 remix released: '
        prefix_len = len(prefix)
        html = ''
        html_escape = {
            "&": "&amp;",
            '"': "&quot;",
            "'": "&apos;",
            ">": "&gt;",
            "<": "&lt;"
        }
        for item in rss['items']:
            timestamp = time.mktime(item['published_parsed'])
            published_date = datetime.datetime.fromtimestamp(timestamp)
            if published_date < cut_off:
                continue

            title = item['title']
            if title.startswith(prefix):
                title = title[prefix_len:]

            tid = int(item['link'].split('/')[-1])
            url = self.get_download_url(tid)

            track_title = "".join(html_escape.get(c, c) for c in title)
            html = html + '<a href="' + url + '">'
            html = html + track_title + '</a><br />'

        if len(html) == 0:
            return

        title = self.title()
        page = self.page(title)
        SendMail().deliver(title, page.format(html))
コード例 #12
0
def get_html(apk_path, device_name, mail_list):
    '''
    获取报告
    :return:
    '''
    try:
        logger.info("开始获取报告!")
        make_env()
        data = {'apk_path': apk_path, 'device_name': device_name}
        print api
        r = requests.post(api, json=data, timeout=3)
        logger.info("服务端状态码:{}".format(r.status_code))
        if r.status_code == 200:
            with open(report_path, 'wb+') as f:
                f.write(r.content)
            logger.info('报告路径:{}'.format(report_path))
            SendMail(mail_list, report_path).send_mail()
            logger.info('发送完成报告!')
        else:
            logger.info('报告获取失败!服务端状态码{}'.format(r.status_code))
    except Exception as e:
        logger.error('报告获取失败!' + '\n' + str(e))
コード例 #13
0
from sendmail import SendMail

send = SendMail()

to = ''
sub = ''
text = ''
html = ''


#mail controller [email protected]
def mail_isvalid(self, mail_to):
    regex = '^(\w|\.|\_|\-)+[@](\w|\_|\-|\.)+[.]\w{2,3}$'
    if (re.search(regex, mail)):
        return True
    else:
        print('wrong char mail')
        return False


send.sendmail(to, sub, text, html)
コード例 #14
0
 def execute(self):
     """ Run the handler. """
     joke = self.get_joke()
     title = self.title()
     page = self.page(title, joke)
     SendMail('DkJokes').deliver(title, page)
コード例 #15
0
    subject = "ADSL connections report %s to %s" % (starttime, endtime)
    log.report(
        sys.argv[0], 2, "Run completed at %s" %
        time.strftime('%d-%b-%Y %H:%M:%S', time.localtime(time.time())))

    if dodbdump:
        fd.close()
        fd2.close()
        fd3.close()

    cur.close()  # and commit
    cur_orin.close()  # and commit

    if testenv == 0:
        SendMail(sendto, "nm", "nm", subject, log.rep)
    else:
        print log.rep

    day = time.strftime('%Y%m%d', time.localtime(time.time()))
    try:
        if testenv:
            rfile = "/tmp/adsl2rads-%s.log" % day
        else:
            rfile = "/import/www/internal/www.off.connect.com.au/htdocs/Reports/ADSL/adsl2rads-%s.log" % day
        f = open(rfile, 'a')
        f.write(log.rep)
        f.close()
    except:
        #print log
        pass