From 9dab6807be9fb8afa8217d566a28d9501247b66a Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 16 Jul 2011 10:25:32 -0600 Subject: [PATCH] News download: Add a default Accept header to all requests --- src/calibre/__init__.py | 2 +- src/calibre/web/feeds/news.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/__init__.py b/src/calibre/__init__.py index cf4d09770c..eb428e9de4 100644 --- a/src/calibre/__init__.py +++ b/src/calibre/__init__.py @@ -341,7 +341,7 @@ def random_user_agent(): def browser(honor_time=True, max_time=2, mobile_browser=False, user_agent=None): ''' Create a mechanize browser for web scraping. The browser handles cookies, - refresh requests and ignores robots.txt. Also uses proxy if avaialable. + refresh requests and ignores robots.txt. Also uses proxy if available. :param honor_time: If True honors pause time in refresh requests :param max_time: Maximum time in seconds to wait during a refresh request diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index c74a9b662c..9773f6d0d8 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -398,7 +398,9 @@ class BasicNewsRecipe(Recipe): return br ''' - return browser(*args, **kwargs) + br = browser(*args, **kwargs) + br.addheaders += [('Accept', '*/*')] + return br def clone_browser(self, br): '''