1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-19 02:40:11 +01:00

Fix Travis errors.

This commit is contained in:
a01200356 2015-12-28 01:17:42 -06:00
parent 1b7e80db03
commit bc2420f8d4

View File

@ -16,19 +16,17 @@ 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',
@ -41,6 +39,7 @@ def replace_pua_chars(text):
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