News download: Allow individual recipes to turn on gzip transfer encoding

This commit is contained in:
Kovid Goyal 2017-02-11 13:52:23 +05:30
parent 4f4af3edf1
commit e06288bc50

View File

@ -389,6 +389,10 @@ class BasicNewsRecipe(Recipe):
#: with the URL scheme of your particular website. #: with the URL scheme of your particular website.
resolve_internal_links = False resolve_internal_links = False
#: Set to True if you want to use gziped transfers. Note that some old servers flake out with this
#: so it is off by default.
handle_gzip = False
# See the built-in recipes for examples of these settings. # See the built-in recipes for examples of these settings.
def short_title(self): def short_title(self):
@ -492,6 +496,8 @@ class BasicNewsRecipe(Recipe):
''' '''
br = browser(*args, **kwargs) br = browser(*args, **kwargs)
br.addheaders += [('Accept', '*/*')] br.addheaders += [('Accept', '*/*')]
if self.handle_gzip:
br.set_handle_gzip(True)
return br return br
def clone_browser(self, br): def clone_browser(self, br):