diff options
author | Markus Heiser <markus.heiser@darmarIT.de> | 2022-02-01 07:19:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-01 07:19:05 +0000 |
commit | 07f7289e23c3ed28bb5e4f71d47e0da554ca9aea (patch) | |
tree | 8a23c54af9896dd5000cb1f151a6fa60a46ee44a | |
parent | 314ea2dc6188a16f277e33229570fe03ec60b7d4 (diff) | |
parent | 50a56532c4dee9fde09ed1fd66320f2ef188ab8f (diff) | |
download | searxng-07f7289e23c3ed28bb5e4f71d47e0da554ca9aea.tar.gz searxng-07f7289e23c3ed28bb5e4f71d47e0da554ca9aea.zip |
Merge pull request #849 from return42/fix-787
[fix] engines description - currency_convert.py
-rw-r--r-- | searx/engines/currency_convert.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py index 969688126..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 @@ -13,18 +13,19 @@ about = { "use_official_api": False, "require_api_key": False, "results": 'JSONP', + "description": "Service from DuckDuckGo.", } 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 @@ -34,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'], |