summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authora01200356 <a01200356@itesm.mx>2015-12-28 01:17:42 -0600
committera01200356 <a01200356@itesm.mx>2015-12-28 01:17:42 -0600
commitbc2420f8d4b51959326f4ee4c44378f1b05abb8c (patch)
tree205e4d1052c2593b91df874c8565ee1a98b2bae1 /searx/engines
parent1b7e80db03faef848d0614493e2bf58366db29ea (diff)
downloadsearxng-bc2420f8d4b51959326f4ee4c44378f1b05abb8c.tar.gz
searxng-bc2420f8d4b51959326f4ee4c44378f1b05abb8c.zip
Fix Travis errors.
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/wolframalpha_api.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/searx/engines/wolframalpha_api.py b/searx/engines/wolframalpha_api.py
index b9da87c8e..309608628 100644
--- a/searx/engines/wolframalpha_api.py
+++ b/searx/engines/wolframalpha_api.py
@@ -16,31 +16,30 @@ from searx.utils import html_to_text
# search-url
base_url = 'http://api.wolframalpha.com/v2/query'
search_url = base_url + '?appid={api_key}&{query}&format=plaintext'
-site_url = 'http://wolframalpha.com/input/?{query}'
+api_key = ''
+
# do search-request
def request(query, params):
params['url'] = search_url.format(query=urlencode({'input': query}),
api_key=api_key)
- # need this for url in response
- global my_query
- my_query = query
-
return params
+
# replace private user area characters to make text legible
def replace_pua_chars(text):
- pua_chars = { u'\uf74c': 'd',
- u'\uf74d': u'\u212f',
- u'\uf74e': 'i',
- u'\uf7d9': '=' }
+ pua_chars = {u'\uf74c': 'd',
+ u'\uf74d': u'\u212f',
+ u'\uf74e': 'i',
+ u'\uf7d9': '='}
for k, v in pua_chars.iteritems():
text = text.replace(k, v)
return text
+
# get response from search-request
def response(resp):
results = []
@@ -55,13 +54,9 @@ def response(resp):
result = search_results.xpath('//pod[attribute::primary="true"]/subpod/plaintext')[0].text
result = replace_pua_chars(result)
- # bind url from site
- result_url = site_url.format(query=urlencode({'i': my_query}))
-
# append result
# TODO: shouldn't it bind the source too?
- results.append({'url': result_url,
- 'answer': result})
+ results.append({'answer': result})
# return results
return results