0

I want to sign into www.renrendai.com using Python. The script works well with other websites but it cannot sign into this website.

I don't know why? Anyone can help me?

import requests
import sys
from 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)
Mike Laren
  • 7,768
  • 17
  • 48
  • 69

0 Answers0