jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/348211 )
Change subject: site_detect.py: Detect database error from reponse.content ......................................................................
site_detect.py: Detect database error from reponse.content
Raise ServerError upon detection.
Bug: T162991 Change-Id: Idd2d19a12e4b61c61aada01d17178d2c378561e9 --- M pywikibot/site_detect.py 1 file changed, 6 insertions(+), 0 deletions(-)
Approvals: jenkins-bot: Verified Xqt: Looks good to me, approved
diff --git a/pywikibot/site_detect.py b/pywikibot/site_detect.py index 4eb78d7..d77a953 100644 --- a/pywikibot/site_detect.py +++ b/pywikibot/site_detect.py @@ -30,6 +30,10 @@ from urlparse import urljoin, urlparse
+SERVER_DB_ERROR_MSG = \ + '<h1>Sorry! This site is experiencing technical difficulties.</h1>' + + class MWSite(object):
"""Minimal wiki site class.""" @@ -56,6 +60,8 @@ raise ServerError('Service Unavailable') elif r.status == 500: raise ServerError('Internal Server Error') + elif r.status == 200 and SERVER_DB_ERROR_MSG in r.content: + raise ServerError('Server cannot access the database')
if fromurl != r.data.url: pywikibot.log('{0} redirected to {1}'.format(fromurl, r.data.url))
pywikibot-commits@lists.wikimedia.org