HTTP authentication

Peter Hansen peter at engcorp.com
Sun Jun 23 21:45:35 EDT 2002


Erik Max Francis wrote:
> 
> Preston Tamkin wrote:
> 
> > hello all. I've just recently jumped on the python bandwagon, and I
> > need
> > some help!
> 
> Derive from the urllib.FancyURLopener class, and override the
> proper_use_password method to return the (user, password) 2-tuple you
> want:
> 
>         http://www.python.org/doc/current/lib/urlopener-objs.html

I think another solution is just to specify the username and 
password in the URL like so:

 ref = urllib.urlopen("http://username:password@host.domain/path/file")

-Peter



More information about the Python-list mailing list