diff options
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: |