From 8b483e262e173037543601d42f0cdc772236f82c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Thu, 21 Jun 2018 09:04:22 +0200 Subject: [PATCH] IrcMiRCARTBot.py:_dispatchPrivmsg(): print message from website if upload fails. IrcMiRCARTBot.py:_uploadToImgur(): additionally return responseHttp.text on failure. --- IrcMiRCARTBot.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/IrcMiRCARTBot.py b/IrcMiRCARTBot.py index 4244c89..9bd7003 100755 --- a/IrcMiRCARTBot.py +++ b/IrcMiRCARTBot.py @@ -163,7 +163,9 @@ class IrcMiRCARTBot(IrcClient.IrcClient): self.clientLastMessage = int(time.time()) else: self._log("Upload failed with HTTP status code {}".format(imgurResponse[0])) + self._log("Message from website: {}".format(imgurResponse[1])) self.queue("PRIVMSG", message[2], "4/!\\ Upload failed with HTTP status code {}!".format(imgurResponse[0])) + self.queue("PRIVMSG", message[2], "4/!\\ Message from website: {}".format(imgurResponse[1])) if os.path.isfile(asciiTmpFilePath): os.remove(asciiTmpFilePath) if os.path.isfile(imgTmpFilePath): @@ -197,7 +199,7 @@ class IrcMiRCARTBot(IrcClient.IrcClient): if responseHttp.status_code == 200: return [200, responseDict.get("data").get("link")] else: - return [responseHttp.status_code] + return [responseHttp.status_code, responseHttp.text] # }}} # {{{ _urlretrieveReportHook(count, blockSize, totalSize): Limit downloads to 1 MB def _urlretrieveReportHook(count, blockSize, totalSize):