python模拟登陆tom邮箱示例分享

代码如下:

def logintom(username, password): url1 = ”’ http://login.mail.tom.com/cgi/login ”’ values = { ‘type’ : ‘0’, ‘user’ : ‘%s’ % username, ‘in_username’ : ‘%s@tom.com’ % username, ‘pass’ : ‘%s’ % password, ‘style’ : ’21’, ‘verifycookie’ : ‘y’ } data = urllib.urlencode(values) req = urllib2.request(url1, data) response = opener.open(req) data2 =response.read() sid = re.search(r'(?