John J. Lee
jjl at pobox.com
Fri Dec 5 00:45:23 CET 2003
Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
> "luigipaioro" <luigipaioro at libero.it> writes:
> > Does anybody know how can I acces to my site with authentication?
> > I think that urllib2 can help me but I don't undestand how!!!
> It's documented in the manual. Try something like (untested):
> import urllib
> class Open_with_auth(urllib.FancyURLopener):
> def prompt_user_passwd(self, host, realm):
> return ('username', 'userpassword') # the uid and passwd you want to use
> urllib._urlopener = Open_with_auth()
Doesn't/shouldn't http://user:email@example.com/blah.html work?
I don't know where that syntax is specified (if anywhere) -- do you
know, Paul? It seems at a glance that urllib understands that syntax
for ordinary Basic Auth., where urlib2 only knows it as a syntax for
proxy Basic Auth., but I may be wrong there...
More information about the Python-list