logo

searx

My custom branche(s) on searx, a meta-search engine
commit: 01de1c6f7808f45698c2207ae1f1b73c1132b088
parent: bbd83f5a519381ac7ea690a1645258d106a9ba8a
Author: Adam Tauber <asciimoo@gmail.com>
Date:   Sat,  2 May 2015 13:34:53 -0400

Merge pull request #303 from dalf/patch-1

Revert of #195 when the search language is not english

Diffstat:

Msearx/engines/google.py3++-
Msearx/tests/engines/test_google.py3++-
2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/searx/engines/google.py b/searx/engines/google.py @@ -76,7 +76,8 @@ def request(query, params): query=urlencode({'q': query})) params['headers']['Accept-Language'] = language - params['cookies']['PREF'] = get_google_pref_cookie() + if language.startswith('en'): + params['cookies']['PREF'] = get_google_pref_cookie() return params diff --git a/searx/tests/engines/test_google.py b/searx/tests/engines/test_google.py @@ -17,12 +17,13 @@ class TestGoogleEngine(SearxTestCase): self.assertIn('url', params) self.assertIn(query, params['url']) self.assertIn('google.com', params['url']) - self.assertIn('PREF', params['cookies']) + self.assertNotIn('PREF', params['cookies']) self.assertIn('fr', params['headers']['Accept-Language']) dicto['language'] = 'all' params = google.request(query, dicto) self.assertIn('en', params['headers']['Accept-Language']) + self.assertIn('PREF', params['cookies']) def test_response(self): self.assertRaises(AttributeError, google.response, None)