From 078cd579cffa2dc0925aa06f898eff693f0d04d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Michael=20O=2E=20Hegg=C3=B8?= <danmichaelo@gmail.com>
Date: Sun, 9 Dec 2018 18:30:55 +0100
Subject: [PATCH] Change InvalidResponse to align with other errors

Storing the message in args[0] seems more Pythonic.
---
 mwclient/errors.py | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/mwclient/errors.py b/mwclient/errors.py
index e649690..763c3af 100644
--- a/mwclient/errors.py
+++ b/mwclient/errors.py
@@ -98,14 +98,16 @@ class NoWriteApi(MwClientError):
 class InvalidResponse(MwClientError):
 
     def __init__(self, response_text=None):
-        self.message = 'Did not get a valid JSON response from the server. Check that ' + \
-                       'you used the correct hostname. If you did, the server might ' + \
-                       'be wrongly configured or experiencing temporary problems.'
+        super(InvalidResponse, self).__init__(
+            'Did not get a valid JSON response from the server. Check that ' +
+            'you used the correct hostname. If you did, the server might ' +
+            'be wrongly configured or experiencing temporary problems.',
+            response_text
+        )
         self.response_text = response_text
-        super(InvalidResponse, self).__init__(self.message, response_text)
 
     def __str__(self):
-        return self.message
+        return self.args[0]
 
 
 class InvalidPageTitle(MwClientError):
-- 
GitLab