From 1ffc7863a060a585ec29b36109ba71af772c9263 Mon Sep 17 00:00:00 2001 From: jesopo Date: Fri, 14 Dec 2018 08:49:37 +0000 Subject: If a request to git.io times out, fall back to full url --- modules/github.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'modules/github.py') diff --git a/modules/github.py b/modules/github.py index c26f7863..6e17e41a 100644 --- a/modules/github.py +++ b/modules/github.py @@ -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("") -- cgit v1.3.1-10-gc9f91