diff options
| author | 2018-12-14 08:49:37 +0000 | |
|---|---|---|
| committer | 2018-12-14 08:49:37 +0000 | |
| commit | 1ffc7863a060a585ec29b36109ba71af772c9263 (patch) | |
| tree | 92edc4632f8bdd04883dc0bc32d4031cedb0875b | |
| parent | Fix missing change to new Response objects from utils.http.request (youtube.py) (diff) | |
| signature | ||
If a request to git.io times out, fall back to full url
| -rw-r--r-- | modules/github.py | 9 |
1 files changed, 6 insertions, 3 deletions
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("") |
