Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2f5f290 + 72a7f7c commit 9f2e0d6Copy full SHA for 9f2e0d6
1 file changed
Lib/test/support/__init__.py
@@ -1029,7 +1029,12 @@ def check_valid_file(fn):
1029
requires('urlfetch')
1030
1031
print('\tfetching %s ...' % url, file=get_original_stdout())
1032
- f = urllib.request.urlopen(url, timeout=15)
+ opener = urllib.request.build_opener()
1033
+ if gzip:
1034
+ opener.addheaders.append(('Accept-Encoding', 'gzip'))
1035
+ f = opener.open(url, timeout=15)
1036
+ if gzip and f.headers.get('Content-Encoding') == 'gzip':
1037
+ f = gzip.GzipFile(fileobj=f)
1038
try:
1039
with open(fn, "wb") as out:
1040
s = f.read()
0 commit comments