diff options
author | Adam Tauber <asciimoo@gmail.com> | 2016-05-04 14:51:33 +0200 |
---|---|---|
committer | Adam Tauber <asciimoo@gmail.com> | 2016-05-04 14:51:33 +0200 |
commit | e9f56fe3eec3baed3f845677a38405f29ac6cd53 (patch) | |
tree | 51abd7caef2cb971d8ae62436ea0dd121f0f5529 /searx | |
parent | f5be28eedb8af728ddb39de5ba4f8df54e9025f3 (diff) | |
parent | 56e53c929777a0a47d9e702219dbab4326c63010 (diff) | |
download | searxng-e9f56fe3eec3baed3f845677a38405f29ac6cd53.tar.gz searxng-e9f56fe3eec3baed3f845677a38405f29ac6cd53.zip |
Merge pull request #553 from Maxqia/convert
[fix] currency_convert: make unit tests pass
Diffstat (limited to 'searx')
-rw-r--r-- | searx/engines/currency_convert.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py index bdcd8f711..b0ffb490a 100644 --- a/searx/engines/currency_convert.py +++ b/searx/engines/currency_convert.py @@ -9,13 +9,13 @@ categories = [] url = 'https://download.finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X' weight = 100 -parser_re = re.compile(u'.*?(\d+(?:\.\d+)?) ([^.0-9].+) (in|to) ([^\.]+)\W*$', re.I) # noqa +parser_re = re.compile(u'.*?(\d+(?:\.\d+)?) ([^.0-9]+) (?:in|to) ([^.0-9]+)', re.I) # noqa db = 1 def normalize_name(name): - name = name.lower().replace('-', ' ') + name = name.lower().replace('-', ' ').rstrip('s') name = re.sub(' +', ' ', name) return unicodedata.normalize('NFKD', name).lower() @@ -40,7 +40,7 @@ def request(query, params): # wrong query return params - ammount, from_currency, none, to_currency = m.groups() + ammount, from_currency, to_currency = m.groups() ammount = float(ammount) from_currency = name_to_iso4217(from_currency.strip()) to_currency = name_to_iso4217(to_currency.strip()) |