From 8c6f05bb540985d3f4559135b8ba89ee52981af2 Mon Sep 17 00:00:00 2001 From: Federico Leva Date: Sun, 16 Feb 2020 16:46:19 +0200 Subject: [PATCH] Consider status code before content in checkIndex() and checkalive.py Fixes https://github.com/WikiTeam/wikiteam/issues/369 --- dumpgenerator.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dumpgenerator.py b/dumpgenerator.py index 9f9863e..ca0c1a9 100755 --- a/dumpgenerator.py +++ b/dumpgenerator.py @@ -1908,6 +1908,9 @@ def checkAPI(api=None, session=None): def checkIndex(index=None, cookies=None, session=None): """ Checking index.php availability """ r = session.post(url=index, data={'title': 'Special:Version'}, timeout=30) + if r.status_code >= 400: + print("ERROR: The wiki returned status code HTTP {}".format({})) + return False raw = r.text print 'Checking index.php...', index # Workaround for issue 71