diff options
author | Christopher Rosell <chrippa@tanuki.se> | 2012-09-07 12:39:17 +0200 |
---|---|---|
committer | Christopher Rosell <chrippa@tanuki.se> | 2012-09-07 12:39:17 +0200 |
commit | d5942525de7b54f7559402d52e89ec08fd987152 (patch) | |
tree | 13118ea3329e832d8cf59e7109a4036661c42ac7 /src/livestreamer/stream.py | |
parent | c6ae74f76f92cd0f7875ab590c6de7669fd635a4 (diff) |
Get rid of urllib and use requests instead.
Diffstat (limited to 'src/livestreamer/stream.py')
-rw-r--r-- | src/livestreamer/stream.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/src/livestreamer/stream.py b/src/livestreamer/stream.py index e71e3bc..f72217b 100644 --- a/src/livestreamer/stream.py +++ b/src/livestreamer/stream.py @@ -1,5 +1,5 @@ -from .utils import urlopen from .compat import str, is_win32 +from .utils import urlopen import os import pbs @@ -89,13 +89,18 @@ class RTMPStream(StreamProcess): return False class HTTPStream(Stream): - def __init__(self, session, url): + def __init__(self, session, url, **args): Stream.__init__(self, session) self.url = url + self.args = args def open(self): - return urlopen(self.url) + try: + res = urlopen(self.url, prefetch=False, **self.args) + except Exception as err: + raise StreamError(str(err)) + return res.raw __all__ = ["StreamError", "Stream", "StreamProcess", "RTMPStream", "HTTPStream"] |