diff options
author | Alexandre Flament <alex@al-f.net> | 2022-04-17 11:37:07 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-17 11:37:07 +0200 |
commit | bbf13a4657d9631374fc949bad8d6e3dc7d37bbc (patch) | |
tree | 71702aaa00fa901775f9685574e397d40af4b599 /searx | |
parent | 52298d676d81b603417f671a4357a6d2f1d30512 (diff) | |
parent | dae8a080898d0dd2d7a8924123b159daece0edd6 (diff) | |
download | searxng-bbf13a4657d9631374fc949bad8d6e3dc7d37bbc.tar.gz searxng-bbf13a4657d9631374fc949bad8d6e3dc7d37bbc.zip |
Merge pull request #1101 from allendema/pass-cookies-from-settings
[enh] Allow passing headers/cookies from settings.yml
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/xpath.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index 2737bf94a..705a5211d 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -85,6 +85,11 @@ suggestion_xpath = '' cached_xpath = '' cached_url = '' +cookies = {} +headers = {} +'''Some engines might offer different result based on cookies or headers. +Possible use-case: To set safesearch cookie or header to moderate.''' + paging = False '''Engine supports paging [True or False].''' @@ -166,6 +171,9 @@ def request(query, params): 'safe_search': safe_search, } + params['cookies'].update(cookies) + params['headers'].update(headers) + params['url'] = search_url.format(**fargs) params['soft_max_redirects'] = soft_max_redirects |