Returns answer rather than results.

More appropriate in this case because it will always give just one
answer.
This commit is contained in:
a01200356 2015-12-26 22:26:59 -06:00
parent 4578575c28
commit 922565c8a9
1 changed files with 3 additions and 6 deletions

View File

@ -18,16 +18,12 @@ 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}'
#embedded_url = '<iframe width="540" height="304" ' +\
# 'data-src="//www.youtube-nocookie.com/embed/{videoid}" ' +\
# 'frameborder="0" allowfullscreen></iframe>'
# 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
need this for url in response
global my_query
my_query = query
@ -63,8 +59,9 @@ def response(resp):
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,
'title': result})
'answer': result})
# return results
return results