Gracefully handle a timeout (wolframalpha)

This commit is contained in:
jesopo 2019-01-20 19:04:32 +00:00
parent 491db4fea4
commit 65f9184a54

View file

@ -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>
""" """
page = utils.http.request(URL_WA, try:
get_params={"i": event["args"], page = utils.http.request(URL_WA,
"appid": self.bot.config["wolframalpha-api-key"], get_params={"i": event["args"],
"reinterpret": "true", "units": "metric"}, code=True) "appid": self.bot.config["wolframalpha-api-key"],
"reinterpret": "true", "units": "metric"}, code=True)
except HTTPTimeoutException:
page = None
if page: if page:
if page.code == 200: if page.code == 200: