diff options
| author | Bnyro <bnyro@tutanota.com> | 2025-07-11 08:42:39 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-11 08:42:39 +0200 |
| commit | a48ec8a4d513b3d80ae4881809e6617db9f5ecaa (patch) | |
| tree | cfdbd1079138cf2d01d84d0b750b26538271d5bb /searx/engines/semantic_scholar.py | |
| parent | 4b9644eb2723b58bdb68f8d97f1220a7645d079e (diff) | |
[chore] engines: remove redundant usages of utils#gen_useragent (#4993)
These engines override the user agent manually using `gen_useragent`, although that's already done in the online preprocessor that runs before the actual `request(query, params)` method is called. Hence, this call is duplicated.
Related:
- https://github.com/searxng/searxng/pull/4990#discussion_r2195142838
Diffstat (limited to 'searx/engines/semantic_scholar.py')
| -rw-r--r-- | searx/engines/semantic_scholar.py | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/searx/engines/semantic_scholar.py b/searx/engines/semantic_scholar.py index 450f3f765..f5a692792 100644 --- a/searx/engines/semantic_scholar.py +++ b/searx/engines/semantic_scholar.py @@ -7,7 +7,7 @@ from lxml import html from flask_babel import gettext from searx.network import get -from searx.utils import eval_xpath_getindex, gen_useragent, html_to_text +from searx.utils import eval_xpath_getindex, html_to_text about = { @@ -41,12 +41,13 @@ def _get_ui_version(): def request(query, params): params['url'] = search_url params['method'] = 'POST' - params['headers'] = { - 'Content-Type': 'application/json', - 'X-S2-UI-Version': _get_ui_version(), - 'X-S2-Client': "webapp-browser", - 'User-Agent': gen_useragent(), - } + params['headers'].update( + { + 'Content-Type': 'application/json', + 'X-S2-UI-Version': _get_ui_version(), + 'X-S2-Client': "webapp-browser", + } + ) params['data'] = dumps( { "queryString": query, |