人人网帐号登录

from urllib import request,parse
import json
from http import cookiejar
# 创建Cookie对象
cookie_object = cookiejar.CookieJar()
# 将Cookie对象添加至请求
handler = request.HTTPCookieProcessor(cookie_object)

opener = request.build_opener(handler)

url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=2018721545104'

form = {
'email':'17698881565',
'icode':'',
'origURL':'http://www.renren.com/home',
'domain':'renren.com',
'key_id':'1',
'captcha_type':'web_login',
'password':'262a5eeb80725cbb0077a0181ac4ca807895630e0e4db14035c31d6bb367a423',
'rkey':'39b392090c635431e86ef76d46f31f40',
'f':'http%3A%2F%2Fguide.renren.com%2Ffillinfonew',
}
# 转换form格式,开始访问
form_byte = parse.urlencode(form).encode('utf-8')
response = opener.open(url,form_byte)
# 获取返回内容
html_bytes = response.read()
# 将json转化为字典格式
res_dict = json.loads(html_bytes.decode('utf-8'))
# 取出所需地址
home_url = res_dict['homeUrl']
# print(home_url)
# 访问地址获得数据
response = opener.open(home_url)
html_bytes = response.read()
print(html_bytes.decode('utf-8'))
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值