I hacked this a little bit and it seems to do the trick.

import urllib2

theurl =
"192.168.0.25/TiVoConnect?Container=%2FNowPlaying&Command=QueryContainer&Recurse=Yes"
print theurl

protocol = 'https://'
username = 'tivo'
password = '1111111111'

authhandler = urllib2.HTTPDigestAuthHandler()
authhandler.add_password("TiVo DVR",
"192.168.0.25", username, password)
opener = urllib2.build_opener(authhandler)
urllib2.install_opener(opener)
try:
        pagehandle = urllib2.urlopen(protocol + theurl)
        print pagehandle.readlines()
except IOError, e:
        if hasattr(e, 'code'):
                if e.code != 401:
                        print 'We got another error'
                        print e.code
                else:
                        print "Error 401"
                        print e.headers
                        print e.headers['www-authenticate']


Cheers

Dave

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to