Ejemplo n.º 1
0
def translateAndWrite(filename, dialectname):
    targetfilename = os.path.join(
        os.path.split(filename)[0], "%s.html" % dialectname)
    fsock = open(targetfilename, "wb")
    fsock.write(dialect.translate(filename, dialectname))
    fsock.close()
def translateAndWrite(filename, dialectname):
	targetfilename = os.path.join(os.path.split(filename)[0], "%s.html" % dialectname)
	fsock = open(targetfilename, "wb")
	fsock.write(dialect.translate(filename, dialectname))
	fsock.close()
Ejemplo n.º 3
0
def send(link):
    # Open a plain text file for reading.  For this example, assume that
    # the text file contains only ASCII characters.
    f = open('mail.html', 'rb')
    html = f.read()
    f.close()
    # Create a text/plain message
    msg = MIMEMultipart('alternative')
    msg['Subject'] = "Hello Marathoner!"
    msg['From'] = '[email protected] Aleksei Marathon Mail'
    msg['To'] = '*****@*****.**'

    html += 'Вот тебе линк на <a href="%s">марафон</a>' % (link)
    part1 = MIMEText(html, 'html')
    msg.attach(part1)

    # Send the message via our own SMTP server, but don't include the
    # envelope header.
    s = smtplib.SMTP('***', port=465)
    s.login('***', '***')
    s.sendmail('***', ['***'], msg.as_string())
    s.quit()

if __name__ == '__main__':
    while True:
        links = translate('http://www.aimsworldrunning.org/Calendar.htm ')
        link = links[random.randint(0, len(links))]
        send(link)
        print 'sent on %s' % (str(datetime.utcnow()))
        secs = random.randint(0 * 3600, 3 * 3600)
        sleep(secs)