I’m trying to port the TiVo plugin to Linux.
(It used some OSX specific popen()s.)
opener.open() throws an exception:
The URL is good, although my browser requires a certificate exception.
<br />
try:<br />
authhandler = urllib2.HTTPDigestAuthHandler()<br />
authhandler.add_password("TiVo DVR", "https://" + tivoip + ":443/", "tivo", Prefs.Get("MAC"))<br />
opener = urllib2.build_opener(authhandler))<br />
pagehandle = opener.open(url)<br />
except IOError, e:<br />
Log.Add("Got a URLError trying to open %s" % url)<br />
if hasattr(e, 'code'):<br />
Log.Add("Failed with code : %s" % e.code)<br />
if (int(e.code) == 401):<br />
dir.SetMessage("Couldn't authenticate", "Failed to authenticate to tivo. Is the Media Access Key correct?")<br />
else:<br />
dir.SetMessage("Couldn't connect", "Failed to connect to tivo")<br />
if hasattr(e, 'reason'):<br />
Log.Add("Failed with reason : %s" % e.reason)<br />
return dir.ToXML()
I read somewhere to check that python has ssl built in:
>>> import socket
>>> socket.ssl
This worked for both my system python and the python
in /usr/lib/plexmediaserver/Resources/Python/bin .
Any other ideas?
Thanks
tlc