If a request to git.io times out, fall back to full url
This commit is contained in:
parent
d2fe95e0cc
commit
1ffc7863a0
1 changed files with 6 additions and 3 deletions
|
@ -105,9 +105,12 @@ class Module(ModuleManager.BaseModule):
|
|||
return ""
|
||||
|
||||
def _short_url(self, url):
|
||||
page = utils.http.request("https://git.io", method="POST",
|
||||
post_data={"url": url})
|
||||
return page.headers["Location"]
|
||||
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("")
|
||||
|
|
Loading…
Reference in a new issue