From 15320b5eec547637b75b18944b352856ae51f55d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 31 Jan 2022 22:49:24 +0100 Subject: [PATCH 1/2] [fix] engines description - currency_convert.py Currency engine has DuckDuckGo metadata In the engine selector of the preferences window, the currency search engine has the same metadata and wikidata url as duckduckgo, I'd assume there should be a difference of some sort there clarifying what source the currency uses or, if it's a duckduckgo service, at least clarifying that it's a currency service by duck duck go. Closes: https://github.com/searxng/searxng/issues/787 Signed-off-by: Markus Heiser --- searx/engines/currency_convert.py | 1 + 1 file changed, 1 insertion(+) diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py index 969688126..df5146807 100644 --- a/searx/engines/currency_convert.py +++ b/searx/engines/currency_convert.py @@ -13,6 +13,7 @@ about = { "use_official_api": False, "require_api_key": False, "results": 'JSONP', + "description": "Service from DuckDuckGo.", } engine_type = 'online_currency' From 50a56532c4dee9fde09ed1fd66320f2ef188ab8f Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 31 Jan 2022 23:11:09 +0100 Subject: [PATCH 2/2] [pylint] engines/currency_convert.py Fix remarks from pylint Signed-off-by: Markus Heiser --- searx/engines/currency_convert.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py index df5146807..18ea6cb19 100644 --- a/searx/engines/currency_convert.py +++ b/searx/engines/currency_convert.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -""" - currency convert (DuckDuckGo) +# lint: pylint +"""Currency convert (DuckDuckGo) """ import json @@ -18,14 +18,14 @@ about = { engine_type = 'online_currency' categories = [] -url = 'https://duckduckgo.com/js/spice/currency/1/{0}/{1}' +base_url = 'https://duckduckgo.com/js/spice/currency/1/{0}/{1}' weight = 100 https_support = True -def request(query, params): - params['url'] = url.format(params['from'], params['to']) +def request(_query, params): + params['url'] = base_url.format(params['from'], params['to']) return params @@ -35,7 +35,7 @@ def response(resp): results = [] try: conversion_rate = float(json.loads(json_resp)['conversion']['converted-amount']) - except: + except ValueError: return results answer = '{0} {1} = {2} {3}, 1 {1} ({5}) = {4} {3} ({6})'.format( resp.search_params['amount'],