aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRicardo Garcia <sarbalap+freshmeat@gmail.com>2011-01-20 20:36:42 +0100
committerRicardo Garcia <sarbalap+freshmeat@gmail.com>2011-01-20 20:36:42 +0100
commit0f6b00b587e9b47919555f9c250b753419063b46 (patch)
treee1245469d72c645b1ee4b4128f5f384383e93b12
parent7b531c0be61b84884302b564a9fc89edde2cfc67 (diff)
downloadyoutube-dl-0f6b00b587e9b47919555f9c250b753419063b46.tar.xz
Improve addinfourl_wrapper for compatibility with older Python versions
-rwxr-xr-xyoutube-dl4
1 files changed, 3 insertions, 1 deletions
diff --git a/youtube-dl b/youtube-dl
index 1b20025e7..103189b21 100755
--- a/youtube-dl
+++ b/youtube-dl
@@ -193,7 +193,9 @@ class YoutubeDLHandler(urllib2.HTTPHandler):
def addinfourl_wrapper(stream, headers, url, code):
if hasattr(urllib2.addinfourl, 'getcode'):
return urllib2.addinfourl(stream, headers, url, code)
- return urllib2.addinfourl(stream, headers, url)
+ ret = urllib2.addinfourl(stream, headers, url)
+ ret.code = code
+ return ret
def http_request(self, req):
for h in std_headers: