diff options
author | Allen <64094914+allendema@users.noreply.github.com> | 2022-04-16 17:42:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-16 17:42:04 +0200 |
commit | 155333f62568e942cf27de83e4bcd037d4010224 (patch) | |
tree | 6507ed1492599fc91faa59c85f06745de20443d6 /searx/engines/xpath.py | |
parent | c474616642890af97ce79700baff7dd47b2406b1 (diff) | |
download | searxng-155333f62568e942cf27de83e4bcd037d4010224.tar.gz searxng-155333f62568e942cf27de83e4bcd037d4010224.zip |
[enh] Allow passing headers/cookies from settings.yml
Example:
- engine: xpath
- search_url: example.org
- headers: {'example_header': 'example_header'}
- cookies: {'safesearch': 'off'}
Diffstat (limited to 'searx/engines/xpath.py')
-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..7a41d9475 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'] = cookies + params['headers'] = headers + params['url'] = search_url.format(**fargs) params['soft_max_redirects'] = soft_max_redirects |