Web authentication urllib2

G

Gabriel

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 .)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top