import requests
#1.获取cookies
resp=requests.get("http://www.baidu.com")
print(resp.cookies.get_dict())
#2.session
dapeng_url="http://www.renren.com/880151247/profile"
login_url="http://www.renren.com/PLogin.do"
headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"}
data = {
"email": "980885033@qq.com",
"password": "980885033..."
}
session=requests.Session()
session.post(login_url,data=data,headers=headers)
response=session.get(dapeng_url)
with open("../other/renrensession.html","w",encoding="utf-8") as fp:
fp.write(response.text)