urllib2: pwd protected urls

Andrei Kulakov ak at silmarill.org
Fri Apr 19 15:11:30 EDT 2002


Hello,

I can't figure out how to get pwd-protected urls using urllib2. Here's
what I'm doing:

>>> from urllib2 import *
>>> a = HTTPBasicAuthHandler()
>>> a.add_password("default", "host.net", "login", "password")
>>> o = build_opener(a)
>>> install_opener(o)
>>> f = urlopen("http://host.net/file.zip")

I get Error 401: Auth required

What's 'realm'? I set it to 'default' and I also tried None.


 - Andrei


-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org



More information about the Python-list mailing list