|
@@ -18,16 +18,12 @@ base_url = 'http://api.wolframalpha.com/v2/query'
|
18
|
18
|
search_url = base_url + '?appid={api_key}&{query}&format=plaintext'
|
19
|
19
|
site_url = 'http://wolframalpha.com/input/?{query}'
|
20
|
20
|
|
21
|
|
-#embedded_url = '<iframe width="540" height="304" ' +\
|
22
|
|
-# 'data-src="//www.youtube-nocookie.com/embed/{videoid}" ' +\
|
23
|
|
-# 'frameborder="0" allowfullscreen></iframe>'
|
24
|
|
-
|
25
|
21
|
# do search-request
|
26
|
22
|
def request(query, params):
|
27
|
23
|
params['url'] = search_url.format(query=urlencode({'input': query}),
|
28
|
24
|
api_key=api_key)
|
29
|
25
|
|
30
|
|
- # need this for url in response
|
|
26
|
+ need this for url in response
|
31
|
27
|
global my_query
|
32
|
28
|
my_query = query
|
33
|
29
|
|
|
@@ -63,8 +59,9 @@ def response(resp):
|
63
|
59
|
result_url = site_url.format(query=urlencode({'i': my_query}))
|
64
|
60
|
|
65
|
61
|
# append result
|
|
62
|
+ # TODO: shouldn't it bind the source too?
|
66
|
63
|
results.append({'url': result_url,
|
67
|
|
- 'title': result})
|
|
64
|
+ 'answer': result})
|
68
|
65
|
|
69
|
66
|
# return results
|
70
|
67
|
return results
|