python实现人人网登录示例分享
来源:
中文源码网 浏览:164 次 日期:2024-05-06 08:34:15
【下载文档: python实现人人网登录示例分享.txt 】
python实现人人网登录示例分享
复制代码 代码如下:import reimport urllib2import cookielib
def renren(): cj = cookielib.LWPCookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj)) email = '' pwd = '' #登录.. print 'login......' url = "http://www.renren.com/PLogin.do" postdata = "email="+email+"&password="+pwd+"&origURL=http%3A%2F%2Fwww.renren.com%2FSysHome.do&domain=renren.com" req = urllib2.Request(url,postdata) res = opener.open(req).read() print 'succeed!' #得到当前状态 s = r'(?s)id="currentStatus">.*?
renren()