En Sat, 24 Jan 2009 06:52:57 -0200, Gabriel <dun...@dreams.sk> escribió:

I'm new in Python and i would like to write script which need to login to a website. I'm experimenting with urllib2,
especially with something like this:

     opener = urllib2.build_opener(urllib2.HTTPCookieProcessor())
     urllib2.install_opener(opener)

     params = urllib.urlencode(dict(username='user', password='pass'))
     f = opener.open('https://web.com', params)
     data = f.read()
     f.close()

And the problem is, that this code logs me in on some sites, but on others doesn't, especially on the one I really need to login. And i don't know why. So is there some way how to debug this code and find out why that script cannot
login on that specific site?

Start by looking at the web page that you normally use to log into the site; probably the form contains more fields than just username and password. In some cases it may be necesary to use ethereal (or any protocol analizer), to see exactly what is actually transmitted when you log in using your browser. Later you may try to reproduce the same thing with Python.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to