BASIC auth ==> access a web site with ID / PW

I am stuck …



I want to access this page:



http://nmt:nmt@www.compiz.de/pch/mediathek/index.php



I try using urllib2 to do this:



**# Create an OpenerDirector with support for Basic HTTP Authentication…

auth_handler = urllib2.HTTPBasicAuthHandler()

auth_handler.add_password(realm=‘ZDFmediathek’,

uri=“http://www.compiz.de/pch/mediathek/index.php”,

user=“nmt”,

passwd=“nmt”)

opener = urllib2.build_opener(auth_handler)

…and install it globally so it can be used with urlopen.

urllib2.install_opener(opener)

urllib2.urlopen(“http://www.compiz.de/pch/mediathek/index.php”)**



==> I get a 401 AUTH error



Any idea , what I do wrong … how else to do this?

first off, you might want to remove username and password from both the link and the code, unless it is a public one…

Sorry, but can’t help with the problem at hand :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.