Gracefully handle a timeout (wolframalpha)
This commit is contained in:
parent
491db4fea4
commit
65f9184a54
1 changed files with 7 additions and 4 deletions
|
@ -14,10 +14,13 @@ class Module(ModuleManager.BaseModule):
|
||||||
:help: Evauate a given string on Wolfram|Alpha
|
:help: Evauate a given string on Wolfram|Alpha
|
||||||
:usage: <query>
|
:usage: <query>
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
page = utils.http.request(URL_WA,
|
page = utils.http.request(URL_WA,
|
||||||
get_params={"i": event["args"],
|
get_params={"i": event["args"],
|
||||||
"appid": self.bot.config["wolframalpha-api-key"],
|
"appid": self.bot.config["wolframalpha-api-key"],
|
||||||
"reinterpret": "true", "units": "metric"}, code=True)
|
"reinterpret": "true", "units": "metric"}, code=True)
|
||||||
|
except HTTPTimeoutException:
|
||||||
|
page = None
|
||||||
|
|
||||||
if page:
|
if page:
|
||||||
if page.code == 200:
|
if page.code == 200:
|
||||||
|
|
Loading…
Reference in a new issue