aboutsummaryrefslogtreecommitdiff
path: root/modules/wolframalpha.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-01-20 19:04:32 +0000
committerGravatar jesopo2019-01-20 19:04:32 +0000
commit65f9184a54c269cc6205981ae5ab8bf1455dfdc7 (patch)
tree6e9e9075b8c6902591b2705953b27c0549576e92 /modules/wolframalpha.py
parentTypo, '9)' -> '()' (github) (diff)
signature
Gracefully handle a timeout (wolframalpha)
Diffstat (limited to 'modules/wolframalpha.py')
-rw-r--r--modules/wolframalpha.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/modules/wolframalpha.py b/modules/wolframalpha.py
index 14c48886..bbf66f3b 100644
--- a/modules/wolframalpha.py
+++ b/modules/wolframalpha.py
@@ -14,10 +14,13 @@ class Module(ModuleManager.BaseModule):
:help: Evauate a given string on Wolfram|Alpha
:usage: <query>
"""
- page = utils.http.request(URL_WA,
- get_params={"i": event["args"],
- "appid": self.bot.config["wolframalpha-api-key"],
- "reinterpret": "true", "units": "metric"}, code=True)
+ try:
+ page = utils.http.request(URL_WA,
+ get_params={"i": event["args"],
+ "appid": self.bot.config["wolframalpha-api-key"],
+ "reinterpret": "true", "units": "metric"}, code=True)
+ except HTTPTimeoutException:
+ page = None
if page:
if page.code == 200: