| I am trying to get the cookies from the site when I login, though html.info(). The problem is that when I check the source ( html.read() ) it shows that it does not recognize me as logged in. Also, if I chech html.info(), the cookies that I am suppose to receive, if I logged in successfully, are not there. What am I doing wrong? import urllib import urllib2 opener = urllib2.build_opener() opener.addheaders = [('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12'), ('Referer', 'http://www.site.org/index.php') ] values = urllib.urlencode({'user_name': 'MyUsername', 'user_pass': 'MyPass^^', 'login' : 'Login'}) req = urllib2.Request('http://www.site.org/index.php', values) html = opener.open(req) print html.info() print html.read() html.close() |
Looking for last minute shopping deals? Find them fast with Yahoo! Search.
_______________________________________________ Tutor maillist - [email protected] http://mail.python.org/mailman/listinfo/tutor
