Hi, I want to make a program that opens a url, finds the data I need, and returns it to me. The problem is I have to login to the website, and I don't know how to do this. I've looked at some examples, and this is what I have so far.

import urllib
import urllib2

# Build opener with HTTPCookieProcessor
o = urllib2.build_opener( urllib2.HTTPCookieProcessor() )
urllib2.install_opener( o )

# Parameters to submit
p = urllib.urlencode( { 'stuident': 'stuid', 'stupassword': 'password' } )

# Login with params
f = o.open( 'https://webconnect.bloomfield.org/Zangle/StudentConnect/',  p )
data = f.read()
print data
f.close()

It doesn't give any errors but it doesn't login either.

I still can't get it to work. I tried using it with different sites and its the same thing: there's no error but it doesn't log in.

Is you password correct?
Next time you say "It doesn't work", post the code were you trying so we can simulate it on our machines.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.