diff options
author | 2011-10-13 20:47:51 +0200 | |
---|---|---|
committer | 2011-10-13 20:47:51 +0200 | |
commit | 5ff656ef3e5ccc7357c4d4e6136be2e15e61281b (patch) | |
tree | 13da870718eae6a073e3f7499b6f545aae64ccf6 /src/livestreamer/plugins/ownedtv.py | |
parent | 9f43ad3e0c14c8782bc9dd69db2c61cb1dd9dc92 (diff) |
Add livestreamer.compat for 2.6 and 2.7 support.
Diffstat (limited to 'src/livestreamer/plugins/ownedtv.py')
-rw-r--r-- | src/livestreamer/plugins/ownedtv.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/livestreamer/plugins/ownedtv.py b/src/livestreamer/plugins/ownedtv.py index e8f004d..b203bb9 100644 --- a/src/livestreamer/plugins/ownedtv.py +++ b/src/livestreamer/plugins/ownedtv.py @@ -2,11 +2,11 @@ from livestreamer.plugins import Plugin, register_plugin from livestreamer.utils import CommandLine +from livestreamer.compat import urllib -import urllib.request, urllib.error, urllib.parse import xml.dom.minidom, re -class RelativeRedirectHandler(urllib.request.HTTPRedirectHandler): +class RelativeRedirectHandler(urllib.HTTPRedirectHandler): def http_error_302(self, req, fp, code, msg, headers): if "location" in headers and headers["location"][0] == "/": absurl = ("{scheme}://{host}{path}").format( @@ -15,10 +15,10 @@ class RelativeRedirectHandler(urllib.request.HTTPRedirectHandler): del headers["location"] headers["location"] = absurl - return urllib.request.HTTPRedirectHandler.http_error_301( + return urllib.HTTPRedirectHandler.http_error_301( self, req, fp, code, msg, headers) -urlopener = urllib.request.build_opener(RelativeRedirectHandler) +urlopener = urllib.build_opener(RelativeRedirectHandler) class OwnedTV(Plugin): @@ -47,7 +47,7 @@ class OwnedTV(Plugin): if not channelid: return False - fd = urllib.request.urlopen(self.ConfigURL.format(channelid)) + fd = urllib.urlopen(self.ConfigURL.format(channelid)) data = fd.read() fd.close() |