http://www.mediawiki.org/wiki/Special:Code/pywikipedia/9150
Revision: 9150 Author: russblau Date: 2011-04-08 13:33:17 +0000 (Fri, 08 Apr 2011) Log Message: ----------- Better debugging info on API errors.
Modified Paths: -------------- branches/rewrite/pywikibot/data/api.py
Modified: branches/rewrite/pywikibot/data/api.py =================================================================== --- branches/rewrite/pywikibot/data/api.py 2011-04-08 13:18:34 UTC (rev 9149) +++ branches/rewrite/pywikibot/data/api.py 2011-04-08 13:33:17 UTC (rev 9150) @@ -17,6 +17,7 @@ import simplejson as json import logging import mimetypes +import pprint import re import traceback import time @@ -349,6 +350,10 @@ continue # raise error try: + pywikibot.log(u"API Error: query=\n%s" + % pprint.pformat(self.params)) + pywikibot.log(u" response=\n%s" + % result) raise APIError(code, info, **result["error"]) except TypeError: raise RuntimeError(result)
pywikipedia-svn@lists.wikimedia.org