changeset: 103499:e84105b48436 branch: 2.7 parent: 103443:951f0de11a01 user: Raymond Hettinger date: Fri Sep 09 16:23:06 2016 -0700 files: Lib/urllib.py Misc/NEWS description: Issue #22450: Use "Accept: */*" in the default headers for urllib diff -r 951f0de11a01 -r e84105b48436 Lib/urllib.py --- a/Lib/urllib.py Fri Sep 09 12:25:27 2016 -0700 +++ b/Lib/urllib.py Fri Sep 09 16:23:06 2016 -0700 @@ -138,7 +138,7 @@ 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 -r 951f0de11a01 -r e84105b48436 Misc/NEWS --- a/Misc/NEWS Fri Sep 09 12:25:27 2016 -0700 +++ b/Misc/NEWS Fri Sep 09 16:23:06 2016 -0700 @@ -47,6 +47,10 @@ - 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.