- 论坛徽章:
- 0
|
本帖最后由 oiiyy 于 2011-03-14 16:34 编辑
import sys,time
from urllib import urlencode
import cookielib, urllib2
cj = cookielib.LWPCookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
urllib2.install_opener(opener)
data = {
'username': '*****',
'userpwd': '*****',
'btnSubmit': '立即登录'
}
urldata = urlencode(data)
print urldata
r=opener.open("http://my.58.com/login/?path=http://chifeng.58.com/", urldata)
time.sleep(5)
r = urllib2.urlopen("http://my.58.com/")
results = r.read()
print results
cj.save("./cookies")
为什么登陆不进去呢? |
|