mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2025-11-24 18:35:13 +00:00
Improve addinfourl_wrapper for compatibility with older Python versions
This commit is contained in:
@@ -193,7 +193,9 @@ class YoutubeDLHandler(urllib2.HTTPHandler):
|
|||||||
def addinfourl_wrapper(stream, headers, url, code):
|
def addinfourl_wrapper(stream, headers, url, code):
|
||||||
if hasattr(urllib2.addinfourl, 'getcode'):
|
if hasattr(urllib2.addinfourl, 'getcode'):
|
||||||
return urllib2.addinfourl(stream, headers, url, code)
|
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):
|
def http_request(self, req):
|
||||||
for h in std_headers:
|
for h in std_headers:
|
||||||
|
|||||||
Reference in New Issue
Block a user