login with urllib2

守株待兔 1248283536 at qq.com
Sun Aug 14 10:50:12 EDT 2011


please to see my code: 
import urllib
import urllib2

url = 'http://hi.baidu.com/'
values = {'username' : '******','password' : '******' }

data = urllib.urlencode(values)
req = urllib2.Request(url,data)
response = urllib2.urlopen(req)
the_page = response.read()

i can't to login ,why?username and password  are  right.
any word  appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110814/8fda9c20/attachment.html>


More information about the Python-list mailing list