python實現(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!'
#得到當前狀態(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)的實現(xiàn)代碼
- python采用requests庫模擬登錄和抓取數(shù)據(jù)的簡單示例
- python人人網(wǎng)登錄應(yīng)用實例
- python實現(xiàn)自動登錄人人網(wǎng)并訪問最近來訪者實例
- python中requests模塊的使用方法
- python實現(xiàn)自動登錄人人網(wǎng)并采集信息的方法
- Python3使用requests包抓取并保存網(wǎng)頁源碼的方法
- Python Requests 基礎(chǔ)入門
- Python Requests安裝與簡單運用
- Python3使用requests登錄人人影視網(wǎng)站的方法
相關(guān)文章
使用numpngw和matplotlib生成png動畫的示例代碼
這篇文章主要介紹了使用numpngw和matplotlib生成png動畫的示例代碼,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-01-01
django數(shù)據(jù)模型(Model)的字段類型解析
Django 開發(fā)環(huán)境與生產(chǎn)環(huán)境的區(qū)分詳解
Python學(xué)習(xí)之函數(shù)的定義與使用詳解
python+pytest接口自動化之token關(guān)聯(lián)登錄的實現(xiàn)

