源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

python实现人人网登录示例分享

  • 时间:2021-10-31 13:27 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:python实现人人网登录示例分享
[u]复制代码[/u] 代码如下:
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()
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部