From: Raymond Hettinger Date: Fri, 9 Sep 2016 23:23:06 +0000 (-0700) Subject: Issue #22450: Use "Accept: */*" in the default headers for urllib X-Git-Tag: v2.7.13rc1~141 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=019a2e225b168de0c72ab3aad895c83aa79ab2d9;p=python Issue #22450: Use "Accept: */*" in the default headers for urllib --- diff --git a/Lib/urllib.py b/Lib/urllib.py index c3ba2c94cb..7f70496b63 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -138,7 +138,7 @@ class URLopener: self.key_file = x509.get('key_file') self.cert_file = x509.get('cert_file') self.context = context - self.addheaders = [('User-Agent', self.version)] + self.addheaders = [('User-Agent', self.version), ('Accept', '*/*')] self.__tempfiles = [] self.__unlink = os.unlink # See cleanup() self.tempcache = None diff --git a/Misc/NEWS b/Misc/NEWS index 63ec3bfaf7..5f3eccb93c 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -47,6 +47,10 @@ Library - Issue #27570: Avoid zero-length memcpy() etc calls with null source pointers in the "ctypes" and "array" modules. +- Issue #22450: urllib now includes an "Accept: */*" header among the + default headers. This makes the results of REST API requests more + consistent and predictable especially when proxy servers are involved. + - lib2to3.pgen3.driver.load_grammar() now creates a stable cache file between runs given the same Grammar.txt input regardless of the hash randomization setting.