1.http://www.renren.com/Login.do
it is ok,my code:
import cookielib, urllib2, urllib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 5.1;
SV1)"),]
opener.addheaders=exheaders
url_login = 'http://www.renren.com/Login.do'
body = (('email',' '), ('password', '))
req1 = opener.open(url_login, urllib.urlencode(body))
file=open('/tmp/sample','w')
file.write(req1.read())
file.close()
2.https://passport.baidu.com/?login
can't login,my code:
import cookielib, urllib2, urllib
cj = cookielib.CookieJar()
opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))
exheaders = [("User-Agent","Mozilla/4.0 (compatible; MSIE 7.1; Windows NT 5.1;
SV1)"),]
opener.addheaders=exheaders
url_login = 'https://passport.baidu.com/?login'
body =(('username',' '), ('password',' '),('pwd','1'))
req1 = opener.open(url_login, urllib.urlencode(body))
file=open('/tmp/sample','w')
file.write(req1.read())
file.close()
what i get is:
<!--STATUS OK-->
<html><head><title>������§�������� </title>
<meta http-equiv=content-type content="text/html; charset=gb2312">
<META http-equiv='Pragma' content='no-cache'>
</head>
<body>
<script>
var url="./?pwd=1"
url=url.replace(/^\.\//gi,"http://passport.baidu.com/");
location.href=url;
</script>
</body>
</html>
--
http://mail.python.org/mailman/listinfo/python-list