Web authentication urllib2

Gabriel dunmer at dreams.sk
Sat Jan 24 03:52:57 EST 2009


Hello,

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?

Sorry if this question is too lame, but i am really beginner both in 
python and web programming .)



More information about the Python-list mailing list