[Tutor] Using urllib to retrieve info

David Holland davholla2002 at yahoo.co.uk
Tue Aug 9 15:53:17 CEST 2005

I had a look at urllib2 and I found this example :-

import urllib2
# Create an OpenerDirector with support for Basic HTTP
auth_handler = urllib2.HTTPBasicAuthHandler()
auth_handler.add_password('realm', 'host', 'username',
opener = urllib2.build_opener(auth_handler)
# ...and install it globally so it can be used with

One question, what does realm refer to and also what
does it mean by host ?

Thanks in advance.
--- Alan G <alan.gauld at freenet.co.uk> wrote:

> > Sorry of course that is the problem.  These pages
> are
> > password protected !!!! 
> > Is it possible to download password protected
> pages (I
> > know the password but I don't how to get the
> program
> > to use it).
> That will depend on how the protection is
> implemented.
> If your server is a J2EE box with full blown
> Kerberos 
> security it may be almost impossible. If it's a more
> conventional server like apache which is protecting 
> a file or folder then you may only have to submit 
> the username and password - ie login! -  or build 
> that into a cookie.
> If the protection is done by the application itself
> then 
> it could be anywhere in between those two extremes.
> HTH,
> Alan G.

To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com

More information about the Tutor mailing list