News download: Add a default Accept header to all requests

This commit is contained in:
Kovid Goyal 2011-07-16 10:25:32 -06:00
parent 1b89baf337
commit 9dab6807be
2 changed files with 4 additions and 2 deletions

View File

@ -341,7 +341,7 @@ def random_user_agent():
def browser(honor_time=True, max_time=2, mobile_browser=False, user_agent=None): 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, 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 honor_time: If True honors pause time in refresh requests
:param max_time: Maximum time in seconds to wait during a refresh request :param max_time: Maximum time in seconds to wait during a refresh request

View File

@ -398,7 +398,9 @@ class BasicNewsRecipe(Recipe):
return br return br
''' '''
return browser(*args, **kwargs) br = browser(*args, **kwargs)
br.addheaders += [('Accept', '*/*')]
return br
def clone_browser(self, br): def clone_browser(self, br):
''' '''