码迷,mamicode.com
首页 > 编程语言 > 详细

python实现人人网登录的例子

时间:2014-07-15 08:27:39      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   数据   

python实现人人网登录的例子

例子,python实现登录人人网。原文地址:http://www.jbxue.com/article/python/22994.html

#!/usr/bin/python
# www.jbxue.com
import re
import urllib2
import 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">.*?<a ui-async="async" title="([^"]*)
match = re.search(s, res, re.DOTALL)
if match:
result = match.groups(1)
print current status: , result[0]
renren()

您可能感兴趣的文章:

python实现人人网登录的例子,布布扣,bubuko.com

python实现人人网登录的例子

标签:style   blog   http   color   os   数据   

原文地址:http://www.cnblogs.com/yes123/p/3841642.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!