1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-22 12:10:11 +01:00

Add user-agent to stract requests

This commit is contained in:
Mikkel Denker 2024-03-22 10:30:53 +01:00 committed by Markus Heiser
parent 32bd55e268
commit b21aaa8907

View File

@ -6,6 +6,7 @@ ends.
""" """
from json import dumps from json import dumps
from searx.utils import searx_useragent
about = { about = {
"website": "https://stract.com/", "website": "https://stract.com/",
@ -23,7 +24,11 @@ search_url = "https://stract.com/beta/api/search"
def request(query, params): def request(query, params):
params['url'] = search_url params['url'] = search_url
params['method'] = "POST" params['method'] = "POST"
params['headers'] = {'Accept': 'application/json', 'Content-Type': 'application/json'} params['headers'] = {
'Accept': 'application/json',
'Content-Type': 'application/json',
'User-Agent': searx_useragent(),
}
params['data'] = dumps({'query': query, 'page': params['pageno'] - 1}) params['data'] = dumps({'query': query, 'page': params['pageno'] - 1})
return params return params