[Tutor] Cookies and authorization

Christian Wyglendowski Christian.Wyglendowski at greenville.edu
Thu Jun 23 20:17:28 CEST 2005


 

> -----Original Message-----
> 
> Hello, everyone!

Hi,

<SNIP>

> My problem is, when I plug this url into my sample code above, I get
> an error ("HTTP Error 401: Authorization Required"), because normally
> when you go to this url it makes you enter in a username and a
> password.  Does anyone know how to get around this, either with code
> commands I can change to embed the password/username, or a way I can
> reformat the URL to *include* the password/username?  I remember
> seeing something like this but I can't get it formatted right.  Say my
> username is "guido" and my password is "python."

Try subclassing urllib.FancyURLopener and overriding the
prompt_user_passwd() method.  That should get you what you need :-)

> Any help would be much appreciated! Thanks :)
> 
> ~Denise

HTH,

Christian
http://www.dowski.com


More information about the Tutor mailing list