from tuozhan_all import session
import json
# url
url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=2018721441132'
# form
form = {
'email': '18510556963',
'icode': '',
'origURL': 'http://www.renren.com/home',
'domain': 'renren.com',
'key_id': '1',
'captcha_type': 'web_login',
'password': '95cb2a1d59b918e0d16ab5d3535fb40103e4b546e651a3e3c99b91876927c78a',
'rkey': 'a7bccfbafd7ee702247450942dff5611',
'f': 'http%3A%2F%2Fwww.renren.com%2F966927992',
}
s = session()
html_bytes = s.post(url, form)
#html_bytes = post(url, form=form)
# 打印結果
#print(html_bytes)
# 通過json獲取一個字典類型
res_dict = json.loads(html_bytes.decode('utf-8'))
home_url = res_dict['homeUrl']
# 訪問頁面
html_bytes = s.get(home_url)
print(html_bytes.decode('utf-8'))
renren
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.