欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python實(shí)現(xiàn)人人網(wǎng)登錄示例分享

 更新時(shí)間:2014年01月19日 16:01:44   作者:  
這篇文章主要介紹了python實(shí)現(xiàn)登錄人人網(wǎng)示例,大家參考使用吧

復(fù)制代碼 代碼如下:

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!'

    #得到當(dāng)前狀態(tài)
    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()

相關(guān)文章

最新評(píng)論