python實(shí)現(xiàn)人人網(wǎng)登錄示例分享
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()
- python cookielib 登錄人人網(wǎng)的實(shí)現(xiàn)代碼
- python采用requests庫(kù)模擬登錄和抓取數(shù)據(jù)的簡(jiǎn)單示例
- python人人網(wǎng)登錄應(yīng)用實(shí)例
- python實(shí)現(xiàn)自動(dòng)登錄人人網(wǎng)并訪問(wèn)最近來(lái)訪者實(shí)例
- python中requests模塊的使用方法
- python實(shí)現(xiàn)自動(dòng)登錄人人網(wǎng)并采集信息的方法
- Python3使用requests包抓取并保存網(wǎng)頁(yè)源碼的方法
- Python Requests 基礎(chǔ)入門
- Python Requests安裝與簡(jiǎn)單運(yùn)用
- Python3使用requests登錄人人影視網(wǎng)站的方法
相關(guān)文章
Python對(duì)字符串實(shí)現(xiàn)去重操作的方法示例
字符串去重是python中字符串操作常見的一個(gè)需求,最近在工作中就又遇到了,所以下面這篇文章主要給大家介紹了關(guān)于Python對(duì)字符串實(shí)現(xiàn)去重操作的相關(guān)資料,文中給出了詳細(xì)的介紹,需要的朋友可以參考借鑒,下面來(lái)一起看看吧。2017-08-08
使用numpngw和matplotlib生成png動(dòng)畫的示例代碼
這篇文章主要介紹了使用numpngw和matplotlib生成png動(dòng)畫的示例代碼,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01
3種Python 實(shí)現(xiàn)酷炫進(jìn)度條的實(shí)用方法
django數(shù)據(jù)模型(Model)的字段類型解析
Django 開發(fā)環(huán)境與生產(chǎn)環(huán)境的區(qū)分詳解
Python學(xué)習(xí)之函數(shù)的定義與使用詳解
使用Python遍歷文件夾實(shí)現(xiàn)查找指定文件夾
python+pytest接口自動(dòng)化之token關(guān)聯(lián)登錄的實(shí)現(xiàn)

