about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-03-10 19:01:29 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2014-03-10 19:03:37 +0100
commit19a41fc613b78073de44407703f53347d44667d6 (patch)
tree5243f4bdf4209515a420c1c6cf4e1c4fdf8277df
parentc4d197ee2d96d4e7881b7bd52104cc4d1cf49be5 (diff)
downloadyoutube-dl-19a41fc613b78073de44407703f53347d44667d6.tar.gz
youtube-dl-19a41fc613b78073de44407703f53347d44667d6.tar.xz
youtube-dl-19a41fc613b78073de44407703f53347d44667d6.zip
Don't set the global socket timeout
Use the timeout argument of the `OpenerDirector.open` method instead
-rw-r--r--youtube_dl/YoutubeDL.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/youtube_dl/YoutubeDL.py b/youtube_dl/YoutubeDL.py
index 523eba3c1..c1bd0b085 100644
--- a/youtube_dl/YoutubeDL.py
+++ b/youtube_dl/YoutubeDL.py
@@ -1167,7 +1167,7 @@ class YoutubeDL(object):
 
     def urlopen(self, req):
         """ Start an HTTP download """
-        return self._opener.open(req)
+        return self._opener.open(req, timeout=self._socket_timeout)
 
     def print_debug_header(self):
         if not self.params.get('verbose'):
@@ -1198,7 +1198,7 @@ class YoutubeDL(object):
 
     def _setup_opener(self):
         timeout_val = self.params.get('socket_timeout')
-        timeout = 600 if timeout_val is None else float(timeout_val)
+        self._socket_timeout = 600 if timeout_val is None else float(timeout_val)
 
         opts_cookiefile = self.params.get('cookiefile')
         opts_proxy = self.params.get('proxy')
@@ -1239,4 +1239,3 @@ class YoutubeDL(object):
 
         # TODO remove this global modification
         compat_urllib_request.install_opener(opener)
-        socket.setdefaulttimeout(timeout)