renren_login_urllib

from tuozhan_all import session
import json
#url
url = 'http://www.renren.com/ajaxLogin/login?1=1&uniqueTimestamp=2018721547856'

#form
form = {
  'email': '15239009262',
  'icode': '',
  'origURL': 'http://www.renren.com/home',
  'domain': 'renren.com',
  'key_id': '1',
  'captcha_type': 'web_login',
  'password': '0ebcab266c90fff23250513f55e2e1f693babcde1667fff0747dc8fc4468f28e',
  'rkey': '847967e38c9676fa9163b969657de0c4',
  'f': 'http%3A%2F%2Freg.renren.com%2Fxn6218.do%3Fss%3D10131%26rt%3D1%26g%3Dv6reg',
}

s = session()
html_bytes = s.post(url, form)

#通过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'))

  

posted on 2018-08-14 23:01  Pyton当歌人生几何  阅读(124)  评论(0编辑  收藏  举报

导航