Automate logging into page

david brochu jr brochu121 at gmail.com
Fri Aug 11 12:36:02 EDT 2006


I am trying to automate logging a website and have been unsuccessful. The
code below is supposed to log me into the site, but changing the
username/password to an incorrect combination does not cause an error or
crash to be seen. My goal is to log into this page and save the cookie from
the page so that when I spawn IE and navigate to this site I will be logged
in. I am using the urllib2 module. Any suggestions?

import urllib
import urllib2
url = '
http://my.compete.com/login?origin=http%3A%2F%2Fmy.compete.com%2Flogin%2F%3Forigin%3D%2F
'
values = {'id_l_email': 'XXXXX', 'id_l_password':'XXXXX'}

data = urllib.urlencode(values)
req = urllib2.Request(url,data)
response = urllib2.urlopen(req)
the_page = response.read()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060811/894f0421/attachment.html>


More information about the Python-list mailing list