aboutsummaryrefslogtreecommitdiff
path: root/modules/wolframalpha.py
diff options
context:
space:
mode:
authorGravatar jesopo2016-03-30 19:31:23 +0100
committerGravatar jesopo2016-03-30 19:31:23 +0100
commit87af05d4b693cb7d98799b10b9e4fce33ad14a71 (patch)
tree04b7a3d2b238a5753ec8729cc6bd2f59d2814e33 /modules/wolframalpha.py
parentfixed a left over reference to event["channel"] that is now broken in to.py. (diff)
added a "hashflag" to modules to stop modules being loaded that rely on a not-present config option.
Diffstat (limited to 'modules/wolframalpha.py')
-rw-r--r--modules/wolframalpha.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/wolframalpha.py b/modules/wolframalpha.py
index 534187dc..3ab5d670 100644
--- a/modules/wolframalpha.py
+++ b/modules/wolframalpha.py
@@ -1,3 +1,5 @@
+#--require-config wolframalpha-api-key
+
import re
import Utils
@@ -21,6 +23,7 @@ class Module(object):
if int(soup.find("queryresult").get("numpods")) > 0:
input = soup.find(id="Input").find("subpod").find("plaintext"
).text
+ answered = False
for pod in soup.find_all("pod"):
if pod.get("primary") == "true":
answer = pod.find("subpod").find("plaintext")
@@ -34,8 +37,11 @@ class Module(object):
match.group(1), 16)), text)
else:
break
+ answered = True
event["stdout"].write(text)
break
+ if not answered:
+ event["stderr"].write("No results found")
else:
event["stderr"].write("No results found")
else: