summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAdam Tauber <asciimoo@gmail.com>2015-12-15 09:48:13 +0100
committerAdam Tauber <asciimoo@gmail.com>2015-12-15 09:48:38 +0100
commitd8f8bdc951f40fa56f1ff61306a78a28958dd41b (patch)
treeed7f985a7f0d1518cae083b056afc0ee4b8a2f3e /searx/engines
parent8b155f78a5190d3e982d9d4df61177516c5c3712 (diff)
downloadsearxng-d8f8bdc951f40fa56f1ff61306a78a28958dd41b.tar.gz
searxng-d8f8bdc951f40fa56f1ff61306a78a28958dd41b.zip
[fix] quickfix for sometimes missing PREF cookie
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/google.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/searx/engines/google.py b/searx/engines/google.py
index 67e6ebb87..b5e12e7cd 100644
--- a/searx/engines/google.py
+++ b/searx/engines/google.py
@@ -202,7 +202,10 @@ def request(query, params):
params['headers']['Accept-Language'] = language
params['headers']['Accept'] = 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8'
if google_hostname == default_hostname:
- params['cookies']['PREF'] = get_google_pref_cookie()
+ try:
+ params['cookies']['PREF'] = get_google_pref_cookie()
+ except:
+ logger.warning('cannot fetch PREF cookie')
params['cookies']['NID'] = get_google_nid_cookie(google_hostname)
params['google_hostname'] = google_hostname