예제 #1
0
def send_mail_via_nifty(to_addr, subject, body, key):
    from_addr = "*****@*****.**"
    account = cipherpickle.loads(__nifty, key)
    msg = __create_message(from_addr, to_addr, subject, body)
    smtp = smtplib.SMTP("smtp.nifty.com", 587)
    # smtp.ehlo()
    # smtp.starttls()
    smtp.ehlo()
    smtp.login(account["username"], account["password"])
    smtp.sendmail(from_addr, [to_addr], msg.as_string())
    smtp.close()

    trace.watch(msg)
    trace.writeline(str(msg))
예제 #2
0
# -*- coding: utf-8 -*-

import urlparse
import urllib2
import re
import os.path

from automain import *
import trace

pat_img1   = re.compile('<img[\s]*src[\s]*=.*?>', re.IGNORECASE)	# imgタグを抜き出す
pat_img2   = re.compile('src[\s]*="(.*?)"', re.IGNORECASE)		    # 画像元URLを抜き出す


elments = urlparse.urlparse('http://www.picfun.com/c15.html')
trace.watch(elments)
print elments.path
print os.path.basename(elments.path)
print os.path.dirname(elments.path)

url = 'http://www.picfun.com/c15.html'
req = urllib2.Request(url)
con = urllib2.urlopen(req)
html = unicode(con.read(),'sjis')

# print html.encode('utf-8')

imgtags = pat_img1.findall(html)
trace.watch(imgtags)

for i in imgtags: