If a request to git.io times out, fall back to full url

This commit is contained in:
jesopo 2018-12-14 08:49:37 +00:00
parent d2fe95e0cc
commit 1ffc7863a0

View file

@ -105,9 +105,12 @@ class Module(ModuleManager.BaseModule):
return ""
def _short_url(self, url):
try:
page = utils.http.request("https://git.io", method="POST",
post_data={"url": url})
return page.headers["Location"]
except utils.http.HTTPTimeoutException:
return url
def _change_count(self, n, symbol, color):
return utils.irc.color("%s%d" % (symbol, n), color)+utils.irc.bold("")