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 ""
|
return ""
|
||||||
|
|
||||||
def _short_url(self, url):
|
def _short_url(self, url):
|
||||||
page = utils.http.request("https://git.io", method="POST",
|
try:
|
||||||
post_data={"url": url})
|
page = utils.http.request("https://git.io", method="POST",
|
||||||
return page.headers["Location"]
|
post_data={"url": url})
|
||||||
|
return page.headers["Location"]
|
||||||
|
except utils.http.HTTPTimeoutException:
|
||||||
|
return url
|
||||||
|
|
||||||
def _change_count(self, n, symbol, color):
|
def _change_count(self, n, symbol, color):
|
||||||
return utils.irc.color("%s%d" % (symbol, n), color)+utils.irc.bold("")
|
return utils.irc.color("%s%d" % (symbol, n), color)+utils.irc.bold("")
|
||||||
|
|
Loading…
Reference in a new issue