aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/livestreamer/utils.py
diff options
context:
space:
mode:
authorGravatar Christopher Rosell <chrippa@tanuki.se>2012-09-08 00:13:07 +0200
committerGravatar Christopher Rosell <chrippa@tanuki.se>2012-09-08 14:32:41 +0200
commit7ce4938cff4b4f352cc2cade258391be2771fede (patch)
treeb9627e73dafe203c061cdbdc1e656e525a0edac1 /src/livestreamer/utils.py
parentd5942525de7b54f7559402d52e89ec08fd987152 (diff)
Add a exception argument to urlopen.
Diffstat (limited to 'src/livestreamer/utils.py')
-rw-r--r--src/livestreamer/utils.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/livestreamer/utils.py b/src/livestreamer/utils.py
index 90b9379..dfee53f 100644
--- a/src/livestreamer/utils.py
+++ b/src/livestreamer/utils.py
@@ -22,14 +22,14 @@ class ArgumentParser(argparse.ArgumentParser):
else:
yield "--%s" % line
-def urlopen(url, method="get", **args):
+def urlopen(url, method="get", exception=PluginError, **args):
if "data" in args and args["data"] is not None:
method = "post"
try:
res = requests.request(method, url, config=RequestsConfig, timeout=15, **args)
except requests.exceptions.RequestException as err:
- raise PluginError(("Unable to open URL: {url} ({err})").format(url=url, err=str(err)))
+ raise exception(("Unable to open URL: {url} ({err})").format(url=url, err=str(err)))
return res