我使用python2.6编写了以下代码,我想将其更改为python3.2和Requests:
import urllib, urllib2
import cookielib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
params = urllib.urlencode(dict(x = '0' , y = '0', url='login.php', password='1234',id='userid'))
f = urllib2.urlopen('http://test.com/login_check.php', params)
data = f.read()
login_response = opener.open('http://aaa.com/bbs/confirm.php?')
htmlContent = login_response.read()
print htmlContent
response.close()