diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-03-11 07:45:08 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-03-11 14:55:38 +0100 |
commit | 8205f170ff983e5240d32dc17d7fdb526ebe5fe7 (patch) | |
tree | 536acda827bcdd1a6668714855e6f6c3ba6b68d4 /searx/engines/base.py | |
parent | 707d6270c80426b54aeaa0ac0acd80ded45df533 (diff) | |
download | searxng-8205f170ff983e5240d32dc17d7fdb526ebe5fe7.tar.gz searxng-8205f170ff983e5240d32dc17d7fdb526ebe5fe7.zip |
[mod] pylint all engines without PYLINT_SEARXNG_DISABLE_OPTION
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines/base.py')
-rwxr-xr-x | searx/engines/base.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/searx/engines/base.py b/searx/engines/base.py index 5a2d66619..5cfcc9250 100755 --- a/searx/engines/base.py +++ b/searx/engines/base.py @@ -1,12 +1,12 @@ # SPDX-License-Identifier: AGPL-3.0-or-later +"""BASE (Scholar publications) + """ - BASE (Scholar publications) -""" +from datetime import datetime +import re from urllib.parse import urlencode from lxml import etree -from datetime import datetime -import re from searx.utils import searx_useragent # about @@ -55,13 +55,17 @@ shorcut_dict = { def request(query, params): # replace shortcuts with API advanced search keywords - for key in shorcut_dict.keys(): - query = re.sub(key, shorcut_dict[key], query) + for key, val in shorcut_dict.items(): + query = re.sub(key, val, query) # basic search offset = (params['pageno'] - 1) * number_of_results - string_args = dict(query=urlencode({'query': query}), offset=offset, hits=number_of_results) + string_args = { + 'query': urlencode({'query': query}), + 'offset': offset, + 'hits': number_of_results, + } params['url'] = base_url.format(**string_args) @@ -99,7 +103,7 @@ def response(resp): try: publishedDate = datetime.strptime(date, date_format) break - except: + except: # pylint: disable=bare-except pass if publishedDate is not None: |