From: Raymond Hettinger Date: Fri, 9 Sep 2016 23:43:48 +0000 (-0700) Subject: Issue #22450: Use "Accept: */*" in the default headers for urllib.request X-Git-Tag: v3.6.0b1~142^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ae9e5f032d05377ec0aef04947b449a9a0d7a3b3;p=thirdparty%2FPython%2Fcpython.git Issue #22450: Use "Accept: */*" in the default headers for urllib.request --- diff --git a/Lib/urllib/request.py b/Lib/urllib/request.py index 3be327dd0063..a4bf97dcd386 100644 --- a/Lib/urllib/request.py +++ b/Lib/urllib/request.py @@ -1625,7 +1625,7 @@ class URLopener: 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 --git a/Misc/NEWS b/Misc/NEWS index aeb38a1d77ca..0b13685447f1 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -70,6 +70,10 @@ Library - 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.