Web authentication

Paul Rubin http
Thu Dec 4 14:47:11 EST 2003


"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()




More information about the Python-list mailing list