urllib2 - Writing a script to sign in web automatically using Python -


i want sign www.renrendai.com using python. script works other websites cannot sign website.

i don't know why? can me?

import requests import sys bs4 import beautifulsoup url = 'https://www.renrendai.com/loginpage.action' sess = requests.session() html1 = sess.get(url).text soup1 = beautifulsoup(html1) p1 = soup1.select("[name=targeturl]")[0]["value"] p2 = soup1.select("[name=returnurl]")[0]["value"] print p1 print p2 data = { "targeturl": p1, "returnurl": p2, "j_username": "15101030402", "j_password": "qwerty123456" } r = sess.post(url, data) msg =      beautifulsoup(sess.get('http://www.renrendai.com/lend/detailpage.action?   loanid=643702').text) type = sys.getfilesystemencoding()  print msg.decode("utf-8").encode(type) 


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -