mirror of
https://github.com/searxng/searxng.git
synced 2024-11-19 02:40:11 +01:00
Revert to using random UA in Reddit search engine
This commit is contained in:
parent
d0001f10e6
commit
d54e82dfb9
@ -15,7 +15,6 @@ from cgi import escape
|
|||||||
from urllib import urlencode
|
from urllib import urlencode
|
||||||
from urlparse import urlparse
|
from urlparse import urlparse
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from searx.utils import searx_useragent
|
|
||||||
|
|
||||||
# engine dependent config
|
# engine dependent config
|
||||||
categories = ['general', 'images', 'news', 'social media']
|
categories = ['general', 'images', 'news', 'social media']
|
||||||
@ -31,9 +30,6 @@ def request(query, params):
|
|||||||
'limit': page_size})
|
'limit': page_size})
|
||||||
params['url'] = search_url.format(query=query)
|
params['url'] = search_url.format(query=query)
|
||||||
|
|
||||||
# using searx User-Agent
|
|
||||||
params['headers']['User-Agent'] = searx_useragent()
|
|
||||||
|
|
||||||
return params
|
return params
|
||||||
|
|
||||||
|
|
||||||
|
@ -3,7 +3,6 @@ import mock
|
|||||||
from searx.engines import reddit
|
from searx.engines import reddit
|
||||||
from searx.testing import SearxTestCase
|
from searx.testing import SearxTestCase
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from searx.utils import searx_useragent
|
|
||||||
|
|
||||||
|
|
||||||
class TestRedditEngine(SearxTestCase):
|
class TestRedditEngine(SearxTestCase):
|
||||||
@ -15,7 +14,6 @@ class TestRedditEngine(SearxTestCase):
|
|||||||
self.assertTrue('url' in params)
|
self.assertTrue('url' in params)
|
||||||
self.assertTrue(query in params['url'])
|
self.assertTrue(query in params['url'])
|
||||||
self.assertTrue('reddit.com' in params['url'])
|
self.assertTrue('reddit.com' in params['url'])
|
||||||
self.assertEqual(params['headers']['User-Agent'], searx_useragent())
|
|
||||||
|
|
||||||
def test_response(self):
|
def test_response(self):
|
||||||
resp = mock.Mock(text='{}')
|
resp = mock.Mock(text='{}')
|
||||||
|
Loading…
Reference in New Issue
Block a user