summaryrefslogtreecommitdiff
path: root/searx/engines/currency_convert.py
diff options
context:
space:
mode:
authorasciimoo <asciimoo@gmail.com>2013-11-10 22:03:16 +0100
committerasciimoo <asciimoo@gmail.com>2013-11-10 22:03:16 +0100
commit1240be48fbe688795ff2aab8fe790242464492b7 (patch)
tree7574fc49567bb8ae04b42038e7c45a665a88f4af /searx/engines/currency_convert.py
parentb9ebf18f598605695c28a3aa4f381c947397d7ee (diff)
downloadsearxng-1240be48fbe688795ff2aab8fe790242464492b7.tar.gz
searxng-1240be48fbe688795ff2aab8fe790242464492b7.zip
[fix] currency converter - valid date url param
Diffstat (limited to 'searx/engines/currency_convert.py')
-rw-r--r--searx/engines/currency_convert.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py
index bfd8c125d..c6a4f29ca 100644
--- a/searx/engines/currency_convert.py
+++ b/searx/engines/currency_convert.py
@@ -1,3 +1,4 @@
+from datetime import datetime
categories = []
url = 'http://finance.yahoo.com/d/quotes.csv?e=.csv&f=sl1d1t1&s={query}=X'
@@ -40,7 +41,13 @@ def response(resp):
)
content = '1 {0} is {1} {2}'.format(resp.search_params['from'], conversion_rate, resp.search_params['to'])
- url = 'http://finance.yahoo.com/currency/converter-results/20131104/{0}-{1}-to-{2}.html'.format(resp.search_params['ammount'], resp.search_params['from'].lower(), resp.search_params['to'].lower())
+ now_date = datetime.now().strftime('%Y%m%d')
+ url = 'http://finance.yahoo.com/currency/converter-results/{0}/{1}-{2}-to-{3}.html'
+ url = url.format(now_date
+ ,resp.search_params['ammount']
+ ,resp.search_params['from'].lower()
+ ,resp.search_params['to'].lower()
+ )
results.append({'title': title, 'content': content, 'url': url})
return results