changeset: 103502:00da8bfa2a60 branch: 3.5 parent: 103500:16d652760a06 user: Raymond Hettinger date: Fri Sep 09 16:43:48 2016 -0700 files: Lib/urllib/request.py Misc/NEWS description: Issue #22450: Use "Accept: */*" in the default headers for urllib.request diff -r 16d652760a06 -r 00da8bfa2a60 Lib/urllib/request.py --- a/Lib/urllib/request.py Fri Sep 09 16:37:53 2016 -0700 +++ b/Lib/urllib/request.py Fri Sep 09 16:43:48 2016 -0700 @@ -1625,7 +1625,7 @@ self.proxies = proxies self.key_file = x509.get('key_file') self.cert_file = x509.get('cert_file') - 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 16d652760a06 -r 00da8bfa2a60 Misc/NEWS --- a/Misc/NEWS Fri Sep 09 16:37:53 2016 -0700 +++ b/Misc/NEWS Fri Sep 09 16:43:48 2016 -0700 @@ -70,6 +70,10 @@ - Issue #27445: Don't pass str(_charset) to MIMEText.set_payload(). Patch by Claude Paroz. +- 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.