diff options
author | Georg Brandl <georg@python.org> | 2014-11-06 14:33:35 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2014-11-06 14:33:35 (GMT) |
commit | 9f2e0d6a86c8384fec5f0e35e0487295d74c3315 (patch) | |
tree | 0e8ef7a5071984a4dd55be36126545359dd6e0f2 | |
parent | 2f5f2908d257eb10a98f5a47ee3dbd96492ed6fa (diff) | |
parent | 72a7f7c476841dde6977f099cc63807df5858c2d (diff) | |
download | cpython-9f2e0d6a86c8384fec5f0e35e0487295d74c3315.zip cpython-9f2e0d6a86c8384fec5f0e35e0487295d74c3315.tar.gz cpython-9f2e0d6a86c8384fec5f0e35e0487295d74c3315.tar.bz2 |
merge with 3.4
-rw-r--r-- | Lib/test/support/__init__.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/test/support/__init__.py b/Lib/test/support/__init__.py index a64ed56..e6db70f 100644 --- a/Lib/test/support/__init__.py +++ b/Lib/test/support/__init__.py @@ -1029,7 +1029,12 @@ def open_urlresource(url, *args, **kw): requires('urlfetch') print('\tfetching %s ...' % url, file=get_original_stdout()) - f = urllib.request.urlopen(url, timeout=15) + opener = urllib.request.build_opener() + if gzip: + opener.addheaders.append(('Accept-Encoding', 'gzip')) + f = opener.open(url, timeout=15) + if gzip and f.headers.get('Content-Encoding') == 'gzip': + f = gzip.GzipFile(fileobj=f) try: with open(fn, "wb") as out: s = f.read() |